The agreement palette, from rust (disagree) through sand (neutral) to green (agree). ggplot2 does not apply theme palettes to ordered factors, so a Likert chart always needs this scale.
Arguments
- palette
"likert"(rust to green, the default) or"quiet".- reverse
TRUEflips the colors, for data ordered from agree to disagree.- drop
Drop unused factor levels? The default
FALSEkeeps every level, so a response nobody chose still holds its place and the colors stay put.- ...
Passed to
ggplot2::discrete_scale().
Details
A 5-point scale gets the five hand-picked colors. Other lengths from 2 to 11 are ramped through them; an odd count centers on the neutral color, an even count has no neutral step.
palette = "quiet" swaps in muted purple and muted sage around a light gray,
for scales with no good or bad end, such as "prefer A" against "prefer B".
Examples
library(ggplot2)
levels <- c("Strongly disagree", "Disagree", "Neither", "Agree", "Strongly agree")
df <- data.frame(
item = rep(c("Easy to use", "Good value"), each = 5),
answer = factor(rep(levels, 2), levels = levels, ordered = TRUE),
share = c(4, 10, 16, 42, 28, 9, 18, 25, 33, 15)
)
ggplot(df, aes(share, item, fill = answer)) +
geom_col(position = position_stack(reverse = TRUE)) +
scale_fill_maison_likert() +
scale_x_continuous(expand = c(0, 0)) +
theme_maison(base_family = "sans", grid = "X", legend_location = "panel")