Friday, 13 May 2016

Plotting in R - some ggplot2 tricks

I love to use ggplot2 for plotting in R, but am a beginner, and trying to master it. Here's some things I've learnt recently.

How to plot multiple figures on one plotI got some hints from stackoverflow. Here's a rough example of a multi-plot with 6 plots, in 2 columns and 3 rows:require(gridExtra)library(ggplot2)# make 6 plots and save as myplot_1, ... myplot_6# make final plot:grid.arrange(myplot1,myplot2,myplot3,myplot4,myplot5,myplot6,ncol=2)