[R] unexpected par('pin') behaviour

Martin Maechler maechler at stat.math.ethz.ch
Fri Jul 15 14:36:16 CEST 2005


Thank you, Joerg,
for the reproducable example 
 
>>>>> "joerg" == joerg van den hoff <j.van_den_hoff at fz-rossendorf.de>
>>>>>     on Thu, 14 Jul 2005 17:19:51 +0200 writes:

  ......................
  ......................

    joerg> ===========cut====================
    joerg> graphics.off()

    joerg> f <- function(n=7, m=6) {
    joerg> nm <- n*m
    joerg> layout(matrix(1:(nm),n,m))
    joerg> opar <- par(no.readonly = T)
    joerg> on.exit(par(opar))
    joerg> par(mar = c(4.1, 4.1, 1.1, 0.1))
    joerg> for (i in 1:nm) plot(i, pch=(i-1)%%25+1)
    joerg> layout(1)
    joerg> }
    joerg> f(5) #good
    joerg> par('pin')
    joerg> f()  #bad (at least for x11() default size)
    joerg> par('pin')
    joerg> ===========cut====================

which I can simplify to

  graphics.off()
  layout(matrix(1:42,7,6))
  par("pin")

  ## [1]  0.2918620 -0.2974408  --- when using x11() "default" 

clearly a bug in layout()  {which I'll file}

and it seems to me, one that is not shared by
par(mfrow= / mfcol=) settings.

Martin Maechler, ETH Zurich




More information about the R-help mailing list