Graphics Reference
In-Depth Information
# With a gradient between two colors
p + scale_colour_gradient(low = "black" , high = "white" )
# A gradient with a white midpoint
library(scales)
p + scale_colour_gradient2(low = muted( "red" ), mid = "white" , high = muted( "blue" ),
midpoint = 110 )
# A gradient of n colors
p + scale_colour_gradientn(colours = c( "darkred" , "orange" , "yellow" , "white" ))
Figure 12-12. Clockwise from top left: default colors, two-color gradient with
scale_colour_gradient(), three-color gradient with midpoint with scale_colour_gradient2(), four-
color gradient with scale_colour_gradientn()
For fill scales, use scale_fill_xxx() versions instead, where xxx is one of gradient , gradi-
ent2 , or gradientn .
Search WWH ::




Custom Search