Manual ggplot2 scales mapping a 1-5 rating (as a factor or its character
codes "1".."5") onto the pal_rating red-amber-green palette.
Usage
scale_fill_rating(distinct = FALSE, ...)
scale_colour_rating(distinct = FALSE, ...)
scale_color_rating(distinct = FALSE, ...)Arguments
- distinct
If
TRUE, use a fully distinct 5-colour ramp where each point has its own shade; ifFALSE(default) use pal_rating, where 1 and 2 share red and 4 and 5 share green. The distinct ramp suits stacked bars, where neighbouring segments need to be told apart.- ...
Passed to
ggplot2::scale_fill_manual()/ggplot2::scale_colour_manual().
Details
Maps the rating codes "1".."5" onto pal_rating, which uses the
bands_rating_3() thresholds (1-2 bad, 3 ok, 4-5 good). Set
distinct = TRUE for a fully distinct 5-colour ramp, which reads better on
stacked bars where adjacent segments must be separable.
scale_color_rating() is an alias of scale_colour_rating().
See also
Other themes:
pal_rating,
scale_fill_nps(),
theme_ezrsurvey(),
theme_transparent()

