Pick the function depending on the aesthetic of your ggplot object (fill or color). See link{cmap_palettes} for a listing of available gradients.

cmap_fill_discrete(palette = "prosperity", reverse = FALSE, ...)

cmap_color_discrete(palette = "prosperity", reverse = FALSE, ...)

cmap_colour_discrete(palette = "prosperity", reverse = FALSE, ...)

Arguments

palette

Choose from 'cmap_palettes' list, or use one of the gradients defined in the 'cmap_gradients' list (gradients will be automatically converted into discrete bins)

reverse

Logical; reverse color order?

...

Additional parameters passed on to the scale type

Functions

  • cmap_fill_discrete(): For fill aesthetic

  • cmap_color_discrete(): For color aesthetic

  • cmap_colour_discrete(): For color aesthetic

Examples

ggplot(pop_and_laborforce_by_age, aes(x = variable, y = value, fill = age)) +
   geom_col(position = position_stack(reverse = TRUE)) +
   facet_wrap(~year) +
   cmap_fill_discrete(palette = "community")


ggplot(percentile_wages, aes(x = percentile, y = wage, color = cluster)) +
   geom_line() +
   cmap_color_discrete(palette = "prosperity")