Skip to contents

Use the color or colour variant for variables mapped to the color aesthetic, and the fill variant for variables mapped to fill. These scales assign colors from the discrete levels supplied to the plot. Use scale_color_sc_map() or scale_fill_sc_map() instead when exact category assignments must remain stable across plots and subsets; use the _sc_c() family for numeric gradients.

Usage

scale_color_sc_d(
  palette = "auto",
  alpha = 1,
  reverse = FALSE,
  selection = c("priority", "source"),
  extend = c("error", "generate"),
  background = c("light", "dark"),
  ...
)

scale_colour_sc_d(
  palette = "auto",
  alpha = 1,
  reverse = FALSE,
  selection = c("priority", "source"),
  extend = c("error", "generate"),
  background = c("light", "dark"),
  ...
)

scale_fill_sc_d(
  palette = "auto",
  alpha = 1,
  reverse = FALSE,
  selection = c("priority", "source"),
  extend = c("error", "generate"),
  background = c("light", "dark"),
  ...
)

Arguments

palette

Palette ID. See sc_palette_names().

alpha

Opacity in (0, 1].

reverse

Reverse the final color sequence.

selection

Use audited "priority" order or exact upstream "source" order.

extend

For qualitative oversubscription, error or generate colors.

background

Background used by deterministic extension.

...

Passed to ggplot2::discrete_scale().

Examples

ggplot2::ggplot(mtcars, ggplot2::aes(factor(cyl), mpg, color = factor(cyl))) +
  ggplot2::geom_point() + scale_color_sc_d()