Skip to contents

A function to apply the TI color palettes to ggplots, using interpolation to ensure the right number of colors

Usage

scale_color_ti(
  palette = "default",
  reverse = FALSE,
  continuous = FALSE,
  .aesthetic = "color",
  .colors = ti_colors,
  .palettes = ti_palettes,
  ...
)

Arguments

palette

The TI palette you want to use. Choose from "default", "teal_to_gold", "teal_to_crimson", "cool_colors", "warm_colors", "skip_gold", "neg_to_pos", "us_rep_to_dem" or "divergent"

reverse

Logical. Default is FALSE. TRUE reverses the palette (e.g. makes "neg_to_pos" start with the positive end rather than the negative end of the colour palette).

continuous

Logical. Default is FALSE. Change to TRUE when applying the color scale to a continuous variable

.aesthetic

Default is "color". Can be changed to "fill", but it's best to use scale_fill_ti() to apply the colour palettes to the fill aesthetic.

.colors

Used to access ti_colors. Please leave as is.

.palettes

Used to access ti_palettes. Please leave as is.

...

Additional arguments to pass to ggplot2::continuous_scale / ggplot2::discrete_scale (e.g. guide, limits, etc.)