| scale_fill_okcolors | R Documentation |
Applies a custom discrete or continuous fill scale to ggplot2 plots using a selected palette from the okcolors package.
scale_fill_okcolors(palette = "obsession", discrete = TRUE, ...)
palette |
Character. Name of the palette to use. Must be one of the palettes available in 'okcolors()'. Default is '"obsession"'. |
discrete |
Logical. Whether to use a discrete scale ('TRUE') or a continuous scale ('FALSE'). Default is 'TRUE'. |
... |
Additional arguments passed to 'ggplot2::discrete_scale()' or 'ggplot2::scale_fill_gradientn()'. |
A 'Scale' object that can be added to a ggplot2 plot.
ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(class, fill = class)) +
ggplot2::geom_bar() +
scale_fill_okcolors("skyscrapers")
ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(displ, hwy, fill = hwy)) +
ggplot2::geom_tile() +
scale_fill_okcolors("obsession", discrete = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.