Alternative notation for multiple additions to a plot - janeshdev/ggplot2 GitHub Wiki

Perhaps useful, perhaps not.

add <- function(...) {dots <- list(...); Reduce("+", dots)}
add(1, 2, 2) # 5
library(ggplot2)

# usual version
qplot(mpg, wt, data=mtcars, facets = vs ~ am)

last_plot() +
 scale_colour_brewer(palette="Set1") +
 scale_x_continuous("x axis")

# alternative notation
qplot(mpg, wt, data=mtcars, facets = vs ~ am)

add(last_plot(), 
 scale_colour_brewer(palette="Set1"),
 scale_x_continuous("x axis"))

# or

qplot(mpg, wt, data=mtcars, facets = vs ~ am) 
last_plot() + list( scale_colour_brewer(palette="Set1"), scale_x_continuous("x axis")
)
⚠️ **GitHub.com Fallback** ⚠️