[R] Multiple plot in a page
Michael Dewey
lists at dewey.myzen.co.uk
Wed Aug 3 11:33:42 CEST 2016
Dear Rosalina
I do not think par(mfrow(c(1, 2)) does what you think it does although
mfrow(c(2, 2)) might.
You could consider using layout() instead
On 03/08/2016 06:44, roslinazairimah zakaria wrote:
> Dear r-users,
>
> I would like to plot 4 graphs arranged as 2 by 2 and follows are my codes.
> However, it only shows one graph.
>
> par(mfrow=c(1,2))
>
> par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs="i", yaxs="i") ## To control
> white space around and between the plots
> hist(stn_all[,1],prob=TRUE, main ="Balok ",col="yellowgreen", cex.axis=1.2,
> xlab="Rain (mm)", ylab="Relative frequency", ylim= c(0,.004),
> xlim=c(0,1200))
> lines(x, dgam1,col="red",lwd=3)
> legend("topright", legend = c("observed","fitted"),
> col = c("yellowgreen", "red"), pch=c(15,NA), lty = c(0, 1),
> lwd=c(0,3),bty="n", pt.cex=2)
> text(100,.012 , expression(paste(beta==64.64)))
> box()
>
> par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs="i", yaxs="i") ## To control
> white space around and between the plots
> hist(stn_all[,2],prob=TRUE, main ="Gambang ",col="yellowgreen",
> cex.axis=1.2,
> xlab="Rain (mm)", ylab="Relative frequency", ylim= c(0,.004),
> xlim=c(0,1200))
> lines(x, dgam2,col="red",lwd=3)
> legend("topright", legend = c("observed","fitted"),
> col = c("yellowgreen", "red"), pch=c(15,NA), lty = c(0, 1),
> lwd=c(0,3),bty="n", pt.cex=2)
> text(100,.012 , expression(paste(beta==64.64)))
> box()
>
>
> Thank you for your help.
>
--
Michael
http://www.dewey.myzen.co.uk/home.html
More information about the R-help
mailing list