r - ggplot2: Use options for multiple plots -
i create 10 plots have different data, same optical appearance. example, i’d change colour of gridline each plot. done adding
+ opts(panel.grid.major = theme_line(colour = "white")   to each plot definition. however, when decide change background colour let’s “grey25”, i’d have modify each plot individually. seems way work. ;)
so, thought doing like
opt1 <- '+ opts(panel.grid.major = theme_line(colour = "white")'   and define each plot like
pl_x <- pl_x + opt1 pl_y <- pl_y + opt1 ...   other options (margins, fonts, scales,…) added opt1. however, doesn’t work (error message when trying print pl_x). maybe knows how accomplish i’d do?
i played around theme_set , theme_update, resulted in none off plots working anymore unless restarted r.
you don't have add + sign.
opt <- opts(panel.grid.major = theme_line(colour = "white"))  pl_x <- pl_x + opt   although doesn't work:
opt <- opts(...) + scale_y_continuous(..)   this does:
opt <- opts(...) syc <- scale_y_continuous(...) pl_x <- pl_x + opt + syc   and hadley's example, works too:
opt <- list(opts(...),scale_y_continuous(...))   note: since version 0.9.2 opts has been replace theme.
Comments
Post a Comment