I would like to change the default colors and fills for all of the geoms in ggplot2. I came across this post and this post which helped me get started on changing the defaults.
However, when I try to change the default for histograms using update_geom_defaults or update_stat_defaults I get the error:
Error: Can't find
geomcalled "histogram"
Is there a way to update colors and fills for geom_histogram using update_*_defaults?
Code:
library(tidyverse)
update_geom_defaults("histogram", list(fill = "black", colour = "black"))
update_stat_defaults("histogram", list(fill = "black", colour = "black"))
#works in ggplot call
ggplot(mtcars)+
geom_histogram(aes(x=mpg), bins = 5, fill = "black")
#works for other geom_*
update_geom_defaults("point", list(fill = "green", colour = "green"))
ggplot(mtcars)+
geom_point(aes(x=mpg,y=cyl))
#additional arguments that do not work with either update function
neither <- c("freqpoly", "histogram", "jitter","sf_label","sf_text")
Using version R 3.6 and 3.2.0 for ggplot2