# Re: [S] Q: plotting multiple graphs of different sizes on one page

Prof Brian Ripley (ripley@stats.ox.ac.uk)
Thu, 30 Apr 1998 17:30:03 +0100

> From: Christian Keller <ckeller@aicos.com>
> To: Raphael Kuznetsovski <rkuznetsovski@lan813.ehsg.saic.com>
>
> "Raphael Kuznetsovski" <rkuznetsovski@lan813.ehsg.saic.com> wrote:
>
> >> ...
> >> For example, what should I do to generate
> >> two plots on one page so that the first plot
> >> would cover 75% of the plotting area and
> >> the second plot would cover the rest (25%)?
>
> There at least two possibilities:
>
> ## Method 1: with the fig argument of par --> see help(par)
> frame() # begin a new figure
> par(fig=c(0,1,0,0.75))
> tsplot(sunspot)
> par(fig=c(0,1,0.65,1))
> tsplot(lynx)
> par(fig=c(0,1,0,1)) # reset fig to default
>
> ## Method 2: if you use trellis graphics --> see help(print.trellis)
> trellis.device(motif)
> print(bwplot(Type ~ Mileage, data=fuel.frame), position=c(0,0,1,0.7),
> more=T)
> print(xyplot(Mileage ~ Weight, data=fuel.frame), position=c(0,0.6,1,1))
>
> You might also be interested in the examples in help(split.screen).
>

I would say that was the easiest way. To use the same example:

split.screen(matrix(c(0,1,0,.75,0,1,0.75,1),2,4, byrow=T))
tsplot(sunspot)
screen(2)
tsplot(lynx)
close.screen(all=T)

and this respects outer margins and allows one to hop around between the
screens. You can even choose the layout interactively.

There is also subplot().
-----------------------------------------------------------------------
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