# NOT RUN {
library("ggplot2")
# default color scale
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_point() + theme_minimal() +
scale_color_discrete_divergingx()
# color scale "Tropic"
ggplot(iris, aes(Sepal.Length, fill = Species)) +
geom_density(alpha = 0.7) + theme_classic() +
scale_fill_discrete_divergingx(palette = "Tropic", rev = TRUE)
# use `nmax` and `order` to skip some colors
ggplot(iris, aes(Sepal.Length, fill = Species)) +
geom_density(alpha = 0.7) + theme_classic() +
scale_fill_discrete_divergingx(palette = "Tropic", nmax = 5, order = c(1, 4, 5))
# }
Run the code above in your browser using DataLab