scale_color_okcolors {okcolors}R Documentation

Custom ggplot2 Color Scale using okcolors Palettes

Description

Applies a custom discrete or continuous color scale to ggplot2 plots using a selected palette from the okcolors package.

Usage

scale_color_okcolors(palette = "obsession", discrete = TRUE, ...)

Arguments

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_color_gradientn()'.

Value

A 'Scale' object that can be added to a ggplot2 plot.

Examples

library(ggplot2)
ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(displ, hwy, color = class)) +
  ggplot2::geom_point(size = 3) +
  scale_color_okcolors("obsession")

ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(displ, hwy, color = hwy)) +
  ggplot2::geom_point(size = 3) +
  scale_color_okcolors("skyscrapers", discrete = FALSE)


[Package okcolors version 0.1.0 Index]