R: ggplot2, how to add a number of layers to a plot at once to reduce code
- by John
library(ggplot2)
This code produces a nice looking plot:
qplot(cty, hwy, data = mpg, colour = displ) +
scale_y_log2() +
labs(x="x axis") +
labs(y="y axis") +
opts(title = "my title")
But I want to setup variables to try and to reduce code repetition:
log_scale <- scale_y_log2()
xscale <- labs(x="x axis")
yscale <- labs(y="y…