View source: R/scale_duke_continuous.R
scale_duke_continuous | R Documentation |
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.
scale_duke_continuous(
...,
low = "#00539B",
high = "#E2E6ED",
space = "Lab",
na.value = "#666666",
guide = "colourbar",
aesthetics = c("colour", "color", "fill")
)
... |
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. |
a visualization with continuous duke color scale
library(ggplot2)
library(palmerpenguins)
# default
ggplot(penguins, aes(x = bill_depth_mm, y = bill_length_mm, color = body_mass_g)) +
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.