cmap_fill_discrete: Apply discrete CMAP palettes to ggplot2 aesthetics

View source: R/colors_discrete.R

cmap_fill_discreteR Documentation

Apply discrete CMAP palettes to ggplot2 aesthetics

Description

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

Usage

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

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

cmap_colour_discrete(palette = "main", 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")


CMAP-REPOS/cmapplot documentation built on March 29, 2025, 11:55 a.m.