Skip to content

Commit 28aec3a

Browse files
authored
Add midpoint example (#5896)
1 parent e3a4daf commit 28aec3a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

R/scale-gradient.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@
5454
#' geom_point(aes(colour = z1)) +
5555
#' scale_colour_gradientn(colours = terrain.colors(10))
5656
#'
57+
#' # The gradientn scale can be centered by using a rescaler
58+
#' ggplot(df, aes(x, y)) +
59+
#' geom_point(aes(colour = z1)) +
60+
#' scale_colour_gradientn(
61+
#' colours = c("blue", "dodgerblue", "white", "orange", "red"),
62+
#' rescaler = ~ scales::rescale_mid(.x, mid = 0)
63+
#' )
64+
#'
5765
#' # Equivalent fill scales do the same job for the fill aesthetic
5866
#' ggplot(faithfuld, aes(waiting, eruptions)) +
5967
#' geom_raster(aes(fill = density)) +

man/scale_gradient.Rd

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)