Rex_Bryan@urscorp.com
2003-Feb-06 18:24 UTC
[R] Fw: Plotting in subareas using par(fig=) parameter
Any idea why I can no longer plot two graphs on the same graphics device using the par(fig=) parameter? A simpler par(mfrow=c(1,2)) does work, showing the two plots side-by-side, but I would like the first to be larger. This simple example fails: x<-c(1,1,NA,2,2,NA,3,3) y<-c(2,4,NA,3,5,NA,1,4) par(fig=c(0,2/3,0,1)) plot(x,y) par(fig=c(2/3,1,0,1)) qqnorm(x) When plotted, the last figure qqnorm(x) is alone on the graphics display. The first figure plot(x,y) disapears. I'm even more puzzled in that I'm sure that I had this type of command working before. REX
Sundar Dorai-Raj
2003-Feb-06 18:31 UTC
[R] Fw: Plotting in subareas using par(fig=) parameter
Try: R> par(fig=c(0,2/3,0,1)) R> plot(x,y) R> par(fig=c(2/3,1,0,1), new = TRUE) R> qqnorm(x) R> From ?par: `new' logical, defaulting to `FALSE'. If set to `TRUE', the next high-level plotting command (actually `plot.new') should not clean the frame before drawing ``as if it was on a new device''. Regards, Sundar Rex_Bryan at urscorp.com wrote:> Any idea why I can no longer plot two graphs on the same graphics device > using the par(fig=) parameter? > A simpler par(mfrow=c(1,2)) does work, showing the two plots side-by-side, > but I would like the first > to be larger. This simple example fails: > > > x<-c(1,1,NA,2,2,NA,3,3) > y<-c(2,4,NA,3,5,NA,1,4) > > par(fig=c(0,2/3,0,1)) > plot(x,y) > > par(fig=c(2/3,1,0,1)) > qqnorm(x) > > When plotted, the last figure qqnorm(x) is alone on the graphics display. > The first figure plot(x,y) disapears. > I'm even more puzzled in that I'm sure that I had this type of command > working before. > > REX > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help >
ripley@stats.ox.ac.uk
2003-Feb-06 18:35 UTC
[R] Fw: Plotting in subareas using par(fig=) parameter
On Thu, 6 Feb 2003, Rex_Bryan at urscorp.com wrote:> Any idea why I can no longer plot two graphs on the same graphics device > using the par(fig=) parameter? > A simpler par(mfrow=c(1,2)) does work, showing the two plots side-by-side, > but I would like the first > to be larger. This simple example fails: > > > x<-c(1,1,NA,2,2,NA,3,3) > y<-c(2,4,NA,3,5,NA,1,4) > > par(fig=c(0,2/3,0,1)) > plot(x,y) > > par(fig=c(2/3,1,0,1))add par(new=TRUE) here, as you want to plot again in the same device region.> qqnorm(x) > > When plotted, the last figure qqnorm(x) is alone on the graphics display. > The first figure plot(x,y) disapears. > I'm even more puzzled in that I'm sure that I had this type of command > working before.-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595