scale_okabeito_discrete: Okabe and Ito's Discrete Color Scheme for 'ggplot2' and...

scale_okabeito_discreteR Documentation

Okabe and Ito's Discrete Color Scheme for ggplot2 and ggraph

Description

Provides the qualitative color scale from Okabe and Ito 2008.

Usage

scale_colour_okabeito(
  ...,
  reverse = FALSE,
  black_position = c("first", "last"),
  aesthetics = "colour"
)

scale_color_okabeito(
  ...,
  reverse = FALSE,
  black_position = c("first", "last"),
  aesthetics = "colour"
)

scale_fill_okabeito(
  ...,
  reverse = FALSE,
  black_position = c("first", "last"),
  aesthetics = "fill"
)

scale_edge_colour_okabeito(
  ...,
  reverse = FALSE,
  black_position = c("first", "last"),
  aesthetics = "edge_colour"
)

scale_edge_color_okabeito(
  ...,
  reverse = FALSE,
  black_position = c("first", "last"),
  aesthetics = "edge_colour"
)

scale_edge_fill_okabeito(
  ...,
  reverse = FALSE,
  black_position = c("first", "last"),
  aesthetics = "edge_fill"
)

Arguments

...

Arguments passed to ggplot2::discrete_scale().

reverse

A logical scalar. Should the resulting vector of colors be reversed?

black_position

A character string giving the position of the black color. It must be one of "first" or "last". Any unambiguous substring can be given.

aesthetics

A character string or vector of character strings listing the name(s) of the aesthetic(s) that this scale works with.

Details

This qualitative color scheme is used as given (no interpolation): colors are picked up to the maximum number of supported values (8).

Value

A discrete scale.

Author(s)

N. Frerebeau

References

Okabe, M. & Ito, K. (2008). Color Universal Design (CUD): How to Make Figures and Presentations That Are Friendly to Colorblind People. URL: https://jfly.uni-koeln.de/color/.

See Also

Other color-blind safe color schemes: scale_crameri_cyclic, scale_crameri_diverging, scale_crameri_mutlisequential, scale_crameri_sequential, scale_tol_discrete, scale_tol_diverging, scale_tol_sequential

Other qualitative color schemes: scale_colour_land(), scale_colour_soil(), scale_colour_stratigraphy(), scale_logical_discrete, scale_tol_bright, scale_tol_dark, scale_tol_highcontrast, scale_tol_light, scale_tol_mediumcontrast, scale_tol_muted, scale_tol_pale, scale_tol_vibrant

Examples

library(ggplot2)

ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) +
  ggplot2::geom_point() +
  scale_colour_okabeito()

ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) +
  ggplot2::geom_point() +
  scale_colour_okabeito(black_position = "last")

khroma documentation built on Aug. 21, 2023, 5:11 p.m.