Re: [S] plot 2+3

Christian Keller (ckeller@aicos.com)
Tue, 19 May 1998 19:19:21 +0200


A much simpler solution (in my opinion) is to use split.screen().

Example:

x <- matrix(rnorm(120),20,6)

split.screen(figs=matrix(c(0,0.5,0.5,1, 0.5,1,0.5,1,
0,1/3,0,0.5, 1/3,2/3,0,0.5, 2/3,1,0,0.5),
ncol=4, byrow=T))
screen(1)
plot(x[,1:2])
screen(2)
plot(x[,2:3])
screen(3)
plot(x[,3:4])
screen(4)
plot(x[,4:5])
screen(5)
plot(x[,5:6])
close.screen(all=T)

See help(split.screen) for an explanation of the argument figs.

Christian Keller

----------------------------------------------------------
Christian Keller Tel: +41 61 686 98 81
AICOS Technologies AG Fax: +41 61 686 98 88
Efringerstrasse 32 email: ckeller@aicos.com
CH-4057 Basel, Switzerland Web: http://www.aicos.com/
----------------------------------------------------------

---------------------------------------------------------------------
Jim Robison-Cox wrote:
>
> On Tue, 19 May 1998, Christian Hoffmann wrote:
>
> > Hi all,
> >
> > I want ot plot 2 figures in the first row of a multiple plot, and 3 figures
> > in the second. How can I do that?
> > Experimenting with
> >
> > par(mfrow=c(2,2))
> > plot( one )
> > plot( two )
> > par(mfg=c(2,2,2,1))
> > par(new=T)
> > Plots on new window: which I do not wnat:
> > par(mfrow=c(1,3))
> > plot( three )
> > plot( four )
> > plot(five)
> >
> > Thanks for all answers.
> > --Christian
> >
> >
> > Christian W. Hoffmann
> > Swiss Federal Institute for Forest, Snow and Landscape Research
> > CH-8903 Birmensdorf, Switzerland
> > phone: ++41-1-739 22 77 fax : ++41-1-739 22 15 e-mail: hoffmann@wsl.ch
> > WWW: http://www.wsl.ch/wsidb/leute/cho/choHPENG.html
>
> Christian,
>
> You need to use the plt plot option with new =T. Here's an example:
>
> x <- matrix(rnorm(120),20,6)
> # set proportions of window in horizontal
> x2cuts <- c(.05,.45,.55,.95)
> x3cuts <- c(.05,.28,.38,.61,.71,.95)
> # and proportions of window vertically
> y.hi <- c(.55,.98)
> y.lo <- c(.08,.45)
> # plot 1 in upper left
> par(plt=c( x2cuts[1:2],y.hi))
> plot(x[,1],x[,2])
> # plot 2 in upper right
> par(plt=c( x2cuts[3:4],y.hi),new=T)
> plot(x[,2],x[,3])
> # plot 3 lower left
> par(plt=c( x3cuts[1:2],y.lo),new=T)
> plot(x[,3],x[,4])
> # plot 4 lower middle
> par(plt=c( x3cuts[3:4],y.lo),new=T)
> plot(x[,4],x[,5])
> #plot 5 lower right:
> par(plt=c( x3cuts[5:6],y.lo),new=T)
> plot(x[,5],x[,6])
>
> Jim Robison-Cox ____________
> Department of Math Sciences | | phone: (406)994-5340
> 2-214 Wilson Hall \ BZN, MT | FAX: (406)994-1789
> Montana State University | *_______|
> Bozeman, MT 59717 \_| e-mail: jimrc@math.montana.edu
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news