
Applying the color palettes to the fill aesthetic within the plots
Source: R/colors.R
scale_fill_ti.RdA function to apply the TI color palettes to ggplots, using interpolation to
ensure the right number of colors.
It builds upon scale_color_ti(), to ensure the two functions remain aligned
in future developments.
Usage
scale_fill_ti(
palette = "default",
reverse = FALSE,
continuous = FALSE,
.aesthetic = "fill",
.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. Change toTRUEto reverse the palette (e.g. to make "neg_to_pos" start with the positive end rather than the negative end of the colour palette).- continuous
Logical. Default is
FALSE. Change toTRUEwhen applying the color scale to a continuous variable- .aesthetic
Default is "fill". Can be changed to "color", but it's best to use
scale_color_ti()to apply the color palettes to the color aesthetic.- .colors
ti_colors
- .palettes
ti_palettes
- ...
Additional arguments to pass to
ggplot2::continuous_scale/ggplot2::discrete_scale(e.g.guide,limits, etc.)