I'm trying to simplify my plots in ggplot2
. Suppose I want to create a scatterplot from iris dataset:
ggplot(iris, aes(x=Petal.Length, y=Petal.Width, colour=Species)) +
geom_point()
But suppose I don't like ggplot2
default theme and palette. Let's say I want to use theme_bw
and Dark2
palette:
ggplot(iris, aes(x=Petal.Length, y=Petal.Width, colour=Species)) +
geom_point() +
theme_bw() +
scale_color_brewer(palette="Dark2")
And suppose I have lots of plots and I want all of them using theme_bw
and Dark2
palette. I know I can use theme_set(theme_bw())
to make all my plots have the black and white theme. Is there a similar function to make all my plots use Dark2
palette? In other words, how can I run a code like
ggplot(iris, aes(x=Petal.Length, y=Petal.Width, colour=Species)) +
geom_point()
and have theme_bw
and Dark2
palette in all my plots?