tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.47k stars 2.02k forks source link

Option to make default colour schemes accessible? #4696

Open hadley opened 2 years ago

hadley commented 2 years ago

It would be a shortcut for changing all of the default colour/fill scales.

yutannihilation commented 2 years ago

Related: #4466

teunbrand commented 2 months ago

Proposal in #5946 is to run this through the theme, so set_theme() can be used to change global defaults.

# From #5946
devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

set_theme(
  theme_gray() +
    theme(
      palette.colour.continuous = pal_div_gradient(),
      palette.colour.discrete = palette.colors(7)
    )
)

p <- ggplot(mpg, aes(displ, hwy))
p + geom_point(aes(colour = cty))

p + geom_point(aes(colour = class))

Created on 2024-06-21 with reprex v2.1.0