I would like to create 10 graphs that have different data, but the same optical appearance. As an example, Id can change the color of the grid line for each graph. This can be done by adding
+ opts(panel.grid.major = theme_line(colour = "white")
for each plot definition. However, when I now decided to change the background color to say "grey25", Id had to modify each plot separately. This seems like too much work .;)
So, I thought about doing something like
opt1 <- '+ opts(panel.grid.major = theme_line(colour = "white")'
and then define each graph as
pl_x <- pl_x + opt1 pl_y <- pl_y + opt1 ...
Other options (fields, fonts, scales, ...) can then be added to opt1. However, this does not work (error message when trying to print pl_x). Does anyone maybe know how to accomplish what I'd like to do?
I also played with theme_set and theme_update, but this did not mean that none of my jobs worked anymore unless I completely restarted R.
r layout plot ggplot2
donodarazao
source share