[R] How to set up the plot region

Jim Lemon jim at bitwrit.com.au
Tue Mar 4 00:38:55 CET 2014


On 03/04/2014 12:40 AM, 张以春 wrote:
> Dear friends,
>
>
> I have a question don't know how to do. I want to plot two graphs in one column of one plot. Also, I want to make every graph to be a square with width to be 8cm, and their gap is 2cm. How do I set up in par()? Thank you very much.
>
>
> Yichun
>
Hi Yichun,
Your question is not entirely clear, but I'll try to make some 
suggestions. If what you mean is the "figure" region (that's the plot 
and the margins around it), you want something like this:

x11(width=3.15,height=7.09)
layout(matrix(c(1,3,2),ncol=1),heights=c(1,0.25,1))
plot(1:5)
plot(1:5)

If you just want plots with nothing around them, maybe this:

x11(width=3.15,height=7.09)
layout(matrix(c(1,3,2),ncol=1),heights=c(1,0.25,1))
par(mar=c(0,0,0,0))
plot(1:5,axes=FALSE)
box()
plot(1:5,axes=FALSE)
box()

Jim




More information about the R-help mailing list