tidyverse / ggplot2

An implementation of the Grammar of Graphics in R

Home Page:https://ggplot2.tidyverse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could a function to reset all geom defaults back to the initial defaults be provided?

davidhodge931 opened this issue · comments

Thanks for the continual ggplot2 updates!

I was wondering if there could be a function to reset all geom defaults back to the initial defaults? Otherwise, you have to know what the defaults are, or restart once you update something.

Something simple like below would be super helpful.

reset_geom_defaults <- function() {
  ggplot2::update_geom_defaults("area", NULL)
  ggplot2::update_geom_defaults("bar", NULL)
  ggplot2::update_geom_defaults("boxplot", NULL)
  ggplot2::update_geom_defaults("col", NULL)
  ... # etc with all geom's there
}

Maybe this could be something for Tidy Dev Day, as hopefully pretty simple??

An idea (maybe for the future) is that it could also have an argument that would allow users to specify only certain geoms to reset

I can see value in a grand reset of the default aesthetics. I feel that the geoms shouldn't be hardcoded like in the example you give, which makes it somewhat more complicated.

you have to know what the defaults are

This isn't strictly true, but you have to know which geoms one should reset.

However, I don't think the update_geom_defaults() will be the 'preferred way' of interacting with defaults after #5833 gets merged.

Thanks, @teunbrand

Do you forsee that update_geom_defaults will be continued to be supported?

I find it super useful

I see no reason for superseding it, so yes I think it'll be around a while.