[R] 2 simple question

Jim Lemon jim at bitwrit.com.au
Sun Apr 25 13:11:56 CEST 2010


On 04/25/2010 06:27 AM, tamas barjak wrote:
> Hi
>
> I do not speak in English very well, I'm sorry.
>
> I try good:
>
> layout(matrix(1:4,ncol=2, byrow=T)) = par(mfrow=c(2, 2))
>
> plot(1,1)<--- anddoes plot in the upper left corner
> plot(2, 2)<--- upper right corner
>
> BUT, I like plot( n, m) for example lower right corner, or lower left
> corner, or again upper right corner etc...
>
> But I received an answer already:
>
> ?split.screen
> ?screen   #same help page
>
>> From this is it any better?
>
Yes, that is probably the one you want. I think that split.screen is the 
only one of the "multiple plot in one device" functions in base graphics 
that allows you to specify the area in which you want to plot.

Unfortunately, split.screen does not seem to preserve the device 
coordinates, so if you go back to a plot:

screen(2)
lines(1:5,rnorm(5))

it does not generally plot in the correct place. I think you might have 
to group your plotting commands:

screen(1)
plot(10:1)
lines(2:4,2:4)
screen(4)
plot(rnorm(6))
points(rnorm(6),col="red")

which you can do with the other multiple plot functions anyway.

Jim



More information about the R-help mailing list