Modern scale functions (fill and colour/color) for ggplot2. For discrete == FALSE, the vmodern scale uses the viridis color palette. For discrete == TRUE, the vmodern color scale returns a modified version of the RColorBrewer 'Dark2' theme if the number of levels is <= 8. Otherwise, the discrete viridis color palette is used.

scale_colour_vmodern(
  discrete = FALSE,
  palette = "high_contrast",
  viridis_option = "plasma",
  ...
)

scale_color_vmodern(
  discrete = FALSE,
  palette = "high_contrast",
  viridis_option = "plasma",
  ...
)

scale_fill_vmodern(
  discrete = FALSE,
  palette = "high_contrast",
  viridis_option = "plasma",
  ...
)

Arguments

discrete

Generate a discrete palette? (default: FALSE - generate continuous palette).

palette

Name of the color palette. Must be one of "high_contrast", "viridis", "bright_contrast", "bright_contrast2", "muted", "muted2".

viridis_option

A character string indicating the color map option to use for viridis. Options are "magma" (or "A"), "inferno" (or "B"), "plasma" (or "C"), "viridis" (or "D"), "cividis" (or "E"), "rocket" (or "F"), "mako" (or "G"), "turbo" (or "H").

...

Additional arguments to pass to ggplot2::discrete_scale() if discrete == TRUE and to viridis::scale_colour_viridis() if discrete == FALSE.

Examples

library(ggplot2)
ggplot(iris) +
  aes(x = Sepal.Length, y = Sepal.Width, color = Petal.Length) +
  geom_point() +
  scale_color_vmodern(discrete = FALSE)

ggplot(iris) +
  aes(x = Sepal.Length, fill = Species) +
  geom_density() +
  scale_fill_vmodern(discrete = TRUE)