I would like to create 10 plots that have different data, but the same optical appearance. As an example, I’d like to change the colour of the gridline for each plot. This could be done by adding
+ opts(panel.grid.major = theme_line(colour = "white")
to each plot definition. However, when I now decide to change background colour to let’s say “grey25”, I’d have to modify each plot individually. This seems like way too much work. ;)
So, I thought about doing something like
opt1 <- '+ opts(panel.grid.major = theme_line(colour = "white")'
and then define each plot like
pl_x <- pl_x + opt1
pl_y <- pl_y + opt1
...
Other options (margins, fonts, scales,…) could then be added to opt1. However, that doesn’t work (error message when trying to print pl_x). Anybody maybe knows how to accomplish what I’d like to do?
I also played around with theme_set and theme_update, but that resulted in none off my plots working anymore unless I completely restarted R.