library(ggplot2)
# Basic usage with automatic type inference
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_point(size = 3, alpha = 0.8) +
scale_color_evanverse("qual_vivid") +
theme_minimal()
# Fill scale for boxplots
ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) +
geom_boxplot(alpha = 0.7) +
scale_fill_evanverse("qual_vivid") +
theme_minimal()
# Reverse color order
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_point(size = 3) +
scale_color_evanverse("qual_vivid", reverse = TRUE) +
theme_minimal()
# Explicitly specify type
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_point(size = 3) +
scale_color_evanverse("qual_vivid", type = "qualitative") +
theme_minimal()
# Limit number of colors
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_point(size = 3) +
scale_color_evanverse("qual_vivid", n = 3) +
theme_minimal()
# Custom legend name and labels
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_point(size = 3) +
scale_color_evanverse(
"qual_vivid",
name = "Iris Species",
labels = c("Setosa", "Versicolor", "Virginica")
) +
theme_minimal()
# Bar plot with fill
ggplot(mtcars, aes(x = factor(cyl), fill = factor(cyl))) +
geom_bar() +
scale_fill_evanverse("qual_vibrant") +
labs(x = "Cylinders", y = "Count", fill = "Cylinders") +
theme_minimal()
Run the code above in your browser using DataLab