-
Multiple plots with different titles using ggplot lapply…
Gifhorn Multiple plots with different titles using ggplot, lapply, and do.call. 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
-
Side by side comparison between ggplot2 and lattice…
femmes coquines sur rochefort Side by side comparison between ggplot2 and lattice http://learnr.wordpress.com/tag/ggplot2/ Code examples and plot output http://wiki.stdout.org/rcookbook/Graphs/ And of course, http://had.co.nz/ggplot2/
-
Differences in zooming or scaling in ggplot Either…
Differences in zooming or scaling in ggplot. Either scale_y_continuous() or coord_cartesian() can be used but they work in slightly different way. scale_y_continuous (or scale_x_continuous) will drop data which are out of the range, while coord_cartesian() won’t. It does not affect the plot if the plot is drawn only with the given data. However, if the…
-
Plot multi column data with ggplot ggplot is…
Plot multi column data with ggplot ggplot is a great visualization tool for R. It draws beautiful plots but the difference from the native plotting system in R takes some time to get used to it. Here are two examples how to plot data in multiple columns. The original data have three columns with one…
-
Using smooth spline in stat scale in ggplot2…
Using smooth.spline in stat_scale in ggplot2 smooth.spline2
-
Setting a scale in ggplot2 scale_y_cont …
Setting a scale in ggplot2 scale_y_continuous(limits = c(10, 200))
-
Save ggplot in pdf Use dev.copy2pdf(fil …
Save ggplot in pdf Use dev.copy2pdf(file=”plot.pdf”) Example) plotA
-
Multi plots in a page gridExtra package …
Multi plots in a page gridExtra package makes it easier to put multiple plots generated by ggplot2 in a page equivalent to par(mfrow= ). Example: http://code.google.com/p/gridextra/wiki/arrange came across through a conversation in StackOverflow http://stackoverflow.com/questions/1249548/side-by-side-plots-with-ggplot2-in-r