scgradient {ggplot} | R Documentation |
Scale a continuous variable along a colour gradient.
scgradient(plot = .PLOT, name="", low='red', mid='white', high="black", midpoint=0, range=c(NA,NA))
plot |
plot object to add scale to |
name |
name of the scale (used in the legend) |
low |
colour at low end of scale |
mid |
colour at middle of scale |
high |
colour at top of scale |
midpoint |
definition of midpoint |
range |
range to scale data to |
This scale creates a continuous colour gradient from the low colour to the mid colour to high colour, as defined in the arguments.
Hadley Wickham <h.wickham@gmail.com>
p <- scgradient(ggplot(movies, aes=list(x=mpaa, y=rating))) ggjitter(p, list(colour=rating)) ggjitter(p, list(colour=length)) p <- ggjitter(p, list(colour=rating)) scgradient(p, low="yellow") scgradient(p, high="green", midpoint=5)