[R] Using" fig=" in one screen created with "split.screen()"
Paul Murrell
p.murrell at auckland.ac.nz
Tue Jul 20 23:51:45 CEST 2010
Hi
split.screen() works by maintaining a set of par(fig) settings, so that
a call to screen() is essentially a call to par(fig=<something>).
Hence, an explicit par(fig=<somethingelse>) call mucks up the plot
arrangement made by screen().
Are you trying to use par(fig) to split up a split.screen() screen into
even smaller pieces? If so, you should be able to do that using
split.screen() (see the examples at the bottom of the help page).
Alternatively, you may be able to create the complete plot arrangement
using layout().
Paul
On 21/07/2010 12:14 a.m., Birte Reichstein wrote:
> Hi,
>
> I successfully created 3 screens with the following:
>
> fig.mat<-c(0,.5,.5,.5,1,1,0,0,.5,1,.5,1)
> fig.mat<-matrix(fig.mat,nrow=3)
> fig.mat
> split.screen(fig.mat)
>
> I can plot three different plots on those 3 screens, but when I try the following:
> (Trying to create three graphs with a common x-axis but different y-axis on screen 1)
>
> screen(1)
> par(oma=c(3,3,0,0))
> par(fig=c(0,1,0,0.33))
> par(mar=c(0,2,0,0.2))
> plot(x,y,ylab="juveniles",type="b")
> par(fig=c(0,1,0.33,0.66),new=T)
> par(mar=c(0,2,0,0.2))
> plot(x,y,ylab="males",type="l",xaxt="n")
> par(fig=c(0,1,0.66,0.99),new=T)
> par(mar=c(0,2,0.2,0.2))
> plot(x,y,ylab="females",type="p",xaxt="n")
> title(xlab="class",ylab="frequency",outer=T)
>
> Screen 1 seems to expand over the whole plotting device instead of being restricted to only the region appointed to Screen 1.
>
> Changing "fig=c(0,1,0,0.33)" to " fig=c(0,0.5,0,0.33)" gives me the result I was looking for. Why do I have to use "fig" in respect to the original plotting device and not in respect to the new one (screen1) ?
>
> I thought the use of split.screen() gives the advantage of having three regions that are treated as separate plotting devices, so that my original code should work. But I guess that I got it wrong ?!?
>
> Thanks for explanations!
>
> /Birte
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/
More information about the R-help
mailing list