How to plot more than one plot in R?



I am currently studying about plotting techniques in R while studying I came across one problem is that if I have more than one plot and I want to plot all the simultaneously how this can be done in R.

for example I have four plot
p1 = ggplot(…)
p2 = ggplot(…)
p3 = ggplot(…)
p4 = ggplot(…)

How to plot all these plots at a time.


try par(mfrow=c(2,2))



You can use par function.
Use par(mfrow=c(nrows,ncols))
You can choose any number of rows and columns. For 4 graphs, use either par(mfrow=c(1,4)) or par(mfrow=c(2,2))
Hope that helps. :slightly_smiling:


Hi @harry

first check your version of ggplot2, with the new version (2.00) there is a problem if you use previous version take the package gridExtra and then function grid.arrange()
grid.arrange( p1,p2,p3,p4)

Hope this help.


If you are looking to plot on the same data, then pairs might help.
Have a look at this link: