[R] unexpected par('pin') behaviour

From: joerg van den hoff <j.van_den_hoff_at_fz-rossendorf.de>
Date: Thu 14 Jul 2005 - 00:00:58 EST

hi everybody,

I noticed the following: in one of my scripts 'layout' is used to generate a (approx. square) grid of variable dimensions (depending on no. of input files). if the no. of subplots (grid cells) becomes moderately large (say > 9) I use a construct like

###layout grid computation and set up occurs here###
   opar <- par(no.readonly = T);
   par(mar=c(4.1, 4.1, 1.1, .1))
###plotting occurs here####


to reduce the figure margins to achieve a more compact display. apart from 'mar' no other par() setting is modified.

this works fine until the total number of subplots becomes too large ("large" depending on the current size of the X11() graphics device window, e.g. 7 x 6 subplots for the default size fo x11()).

I then get the error message (only _after_ all plots are correctly displayed, i.e. obviously during execution of the above on.exit() call)

Error in par(opar) :
invalid value specified for graphics parameter "pin"

and par("pin") yields:

[1] 0.34864 -0.21419

which indeed is invalid (negative 2nd component).

I'm aware of this note from ?par:

    The effect of restoring all the (settable) graphics parameters as

      in the examples is hard to predict if the device has been resized.
      Several of them are attempting to set the same things in different
      ways, and those last in the alphabet will win.  In particular, the
      settings of 'mai', 'mar', 'pin', 'plt' and 'pty' interact, as do
      the outer margin settings, the figure layout and figure region

but my problem occurs without any resizing of the x11() window prior to resetting par to par(opar).

any ideas, what is going on?

platform powerpc-apple-darwin7.9.0

arch     powerpc
os       darwin7.9.0

system powerpc, darwin7.9.0
status Patched
major 2
minor 1.0
year 2005
month 05
day 12
language R



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 14 00:04:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:37 EST