Skip to contents

Manual fill scale mapping the NPS-group coding ("-1" / "0" / "1") onto the pal_nps palette.

Usage

scale_fill_nps(...)

Arguments

...

Passed to ggplot2::scale_fill_manual().

Value

A ggplot2 scale.

Details

Maps the NPS-group coding from nps_group() ("-1" detractor, "0" passive, "1" promoter) onto the pal_nps red/amber/green palette, so the colours carry their usual meaning. Used by plot_nps().

Examples

df <- data.frame(score = 0:2, pct = c(20, 30, 50), group = c(-1, 0, 1))
ggplot(df, aes(score, pct, fill = factor(group))) +
  geom_col() +
  scale_fill_nps()