Multiple plots with different titles using ggplot lapply…


Tala Multiple plots with different titles using ggplot, lapply, and do.call.

Scicli parameters = data.frame(p1=letters[1:5], p2=round(rnorm(5),2)) l = replicate(5, data.frame(x=1:10, y=rnorm(10)), simplify=FALSE) names(l) = do.call(paste, c(parameters, sep=","))   plot_one = function(x) ggplot(data = l[[x]]) + geom_path(aes(x, y)) + opts(title = x)   plots = lapply(names(l), plot_one)   do.call(gridExtra::grid.arrange, plots)

Created by Pretty R at inside-R.org

http://stackoverflow.com/questions/10726470/ggplot-over-many-data-frames-changing-titles


Leave a Reply

Your email address will not be published. Required fields are marked *