Applies a Duke branded and accessible continuous color scale to ggplot geometric objects. It is applicable for both fill and color arguments. Defines gradient scale from dark to light to improve visibility and contrast for readers.
Usage
scale_duke_continuous(
...,
low = "#00539B",
high = "#E2E6ED",
space = "Lab",
na.value = "#666666",
guide = "colourbar",
aesthetics = c("colour", "color", "fill")
)
Arguments
- ...
Arguments passed on to continuous_scale().
- low
Low end of color gradient.
- high
High end of color gradient.
- space
Color space in which to calculate gradient.
- na.value
Color used for NA values.
- guide
Type of legend. "colorbar" for continuous scale, "legend" for discrete scale.
- aesthetics
String or vector of strings detailing what aesthetic features this continuous scale can apply to.
Examples
library(ggplot2)
library(palmerpenguins)
# default
ggplot(penguins, aes(x = bill_depth_mm, y = bill_length_mm, color = body_mass_g)) +
geom_point()
#> Warning: Removed 2 rows containing missing values (`geom_point()`).
# vs. with Duke scale
ggplot(penguins, aes(x = bill_depth_mm, y = bill_length_mm, color = body_mass_g)) +
geom_point() +
scale_duke_continuous()
#> Warning: Removed 2 rows containing missing values (`geom_point()`).