R-beta: mfg weirdness

Ross Ihaka ihaka at stat.auckland.ac.nz
Thu Mar 26 11:49:28 CET 1998


> From: Bill Simpson <wsimpson at uwinnipeg.ca>
> To: r-help <r-help at stat.math.ethz.ch>
> Subject: R-beta: mfg weirdness
>
> It seems there are problems with mfg, both the old version .61.2 and the
> snapshot .62.
>
> > x<-rnorm(100)
> > y<-rnorm(100)
> > y1<-x/y
> > x11()            
> > par(mfcol=c(2,1))
> > par(mai=c(.6,.6,.2,.2))
> > plot(x,y,mfg=c(2,1,2,1))
> I'm not sure if 2,1 is considered the top or the bottom position on the
> page, but whether you say mfg=c(2,1,2,1) or mfg=c(1,1,2,1), the first plot
> is always drawn at the top position.
> > plot(x,y,mfg=c(2,1,2,1))
> Now the second plot is drawn at the bottom position.  Again, the mfg
> argument has no effect. The second plot is always at the bottom
> > plot(x,y1,mfg=c(2,1,2,1))
> Now the whole figure is cleared and a single plot appears at the top.
>
> Further plots alternate in position in this way, independent of mfg.


I just checked my S manual and it appears that layout parameters like
can "mfg" only be given in par().  I think that in fact "mfg" is only
meant to be queried.


Perhaps not unrelatedly ...

After some discussion with Paul Murrell I am inclined to think that
the whole graphics system needs a rewrite, even though this would
mean incompatibility with S.  A major problem is that the whole "par"
system does not work when devices can be resized.  Consider the
following series of steps:

	x11()
	opar <- par()		# save parameters

	# manually resize window

	par(opar)		# restore saved parameters

Before the resize, "fig" and "fin" are compatible, but after the resize
they are not.  So which should be used to determine the plot layout?

[ Splus seems to get around this by not changing the nominal plot size
when the graphics window is resized.  (Check the value of "din", "fin",
etc. before and after a resize)]

In Paul's work on maintaining display lists, he keeps track of the
units which a user used to set up a plot (was it "fin" or "fig"?)
and recomputes plot layouts using this unit information.

In interpreted code the saving and restoring of the graphics state is
done with

	opar <- par()

	...

	par(opar)

This can't work when window resizing is allowed.

Does anyone have any thoughts about how important it is to retain
compatibility with the S way of doing things?

	Ross
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list