scale_okabe_ito: Okabe-Ito Scales for ggplot2 and ggraph

View source: R/scales.R

scale_okabe_itoR Documentation

Okabe-Ito Scales for ggplot2 and ggraph

Description

Discrete scales for the colorblind-friendly Okabe-Ito palette, including color, fill, and edge_colour. See palette_okabe_ito for details.

Usage

scale_okabe_ito(aesthetics, order = 1:9, alpha = 1, ...)

scale_colour_okabe_ito(aesthetics = "colour", order = 1:9, alpha = NULL, ...)

scale_color_okabe_ito(aesthetics = "colour", order = 1:9, alpha = NULL, ...)

scale_fill_okabe_ito(aesthetics = "fill", order = 1:9, alpha = NULL, ...)

scale_edge_colour_okabe_ito(
  aesthetics = "edge_colour",
  order = 1:9,
  alpha = NULL,
  ...
)

scale_edge_color_okabe_ito(
  aesthetics = "edge_colour",
  order = 1:9,
  alpha = NULL,
  ...
)

Arguments

aesthetics

The names of the aesthetics that this scale works with.

order

A numeric vector, the order of the colors, or a character vector of color names, of: "black", "orange", "skyblue", "bluishgreen", "yellow", "blue", "vermillion", "reddishpurple", "gray". If alpha is not NULL, you must use an integer vector since the colors are not returned with names.

alpha

an alpha-transparency level in the range [0,1] (0 means transparent and 1 means opaque).

...

Additonal arguments passed to ggplot2::discrete_scale()

Value

A ggplot or ggraph scale

Examples

library(ggplot2)

ggplot(mpg, aes(cty, hwy, color = class)) +
  geom_point() +
  scale_color_okabe_ito()

ggplot(mpg, aes(cty, hwy, color = factor(cyl))) +
  geom_point(alpha = 0.7) +
  scale_color_okabe_ito(name = "Cylinders", alpha = .9)

ggplot(mpg, aes(hwy, color = class, fill = class)) +
  geom_density() +
  scale_fill_okabe_ito(name = "Class", alpha = .9) +
  scale_color_okabe_ito(name = "Class")

malcolmbarrett/ggokabeito documentation built on July 1, 2023, 8:14 p.m.