library(cheem)
library(ggplot2)
g <- ggplot(mtcars, aes(disp, mpg))
## Discrete
g + geom_point(aes(color = factor(vs))) +
color_scale_of(mtcars$vs)
## Sequential increasing
g + geom_point(aes(color = mpg)) +
color_scale_of(mtcars$mpg)
## Dummy sequential decr
g + geom_point(aes(color = -1 *mpg)) +
color_scale_of(-1 * mtcars$mpg)
## Dummy diverging
g + geom_point(aes(color = mpg - median(mpg))) +
color_scale_of(mtcars$mpg - median(mtcars$mpg))
## Dummy limits
g + geom_point(aes(color = mpg - median(mpg))) +
color_scale_of(mtcars$mpg - median(mtcars$mpg), limits = c(-5, 5))
Run the code above in your browser using DataLab