scale_OkabeIto: Okabe-Ito color scale

Description Arguments Examples

View source: R/scales.R

Description

This is a color-blind friendly, qualitative scale with eight different colors. See palette_OkabeIto for details.

Arguments

...

common discrete scale parameters: name, breaks, labels, na.value, limits, guide, and aesthetics. See discrete_scale for more details.

use_black

If TRUE, scale includes black, otherwise includes gray.

order

Numeric vector listing the order in which the colors should be used. Default is 1:8.

darken

Relative amount by which the scale should be darkened (for positive values) or lightened (for negatice values).

alpha

Alpha transparency level of the color. Default is no transparency.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(ggplot2)
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
  geom_point() + scale_color_OkabeIto()
ggplot(iris, aes(Sepal.Length, fill = Species)) +
  geom_density(alpha = 0.7) + scale_fill_OkabeIto(order = c(1, 3, 5))

cowplot::plot_grid(
  gg_color_swatches(8) + scale_fill_OkabeIto(darken = 0.6),
  gg_color_swatches(8) + scale_fill_OkabeIto(darken = 0.4),
  gg_color_swatches(8) + scale_fill_OkabeIto(darken = 0.2),
  gg_color_swatches(8) + scale_fill_OkabeIto(darken = 0),
  gg_color_swatches(8) + scale_fill_OkabeIto(darken = -0.2),
  gg_color_swatches(8) + scale_fill_OkabeIto(darken = -0.4),
  gg_color_swatches(8) + scale_fill_OkabeIto(darken = -0.6), ncol = 1)

clauswilke/colorblindr documentation built on Aug. 27, 2020, 1:57 a.m.