[R] par("din") vs dev.size()

Sarah Goslee sarah.goslee at gmail.com
Fri Jul 18 18:37:53 CEST 2008


Hello,

I was messing around with graphics, and noted an odd behavior of par("din"). If
the x11 device is empty, par("din") does not return the correct size
if the device
has been resized manually.  dev.size() works correctly.

R version 2.7.1; Fedora 8

# case 1 - empty device

> x11()
> dev.size()
[1] 6.995263 6.994187
> par("din")
[1] 6.995263 6.994187

# resize device
> dev.size()
[1] 6.995263 3.401667
> par("din")
[1] 6.995263 6.994187
> dev.off()

# case 2, device containing a plot

> x11()
> plot(1,1)
> dev.size()
[1] 6.995263 6.994187
> par("din")
[1] 6.995263 6.994187

# resize device
> dev.size()
[1] 6.995263 2.772976
> par("din")
[1] 6.995263 2.772976
> dev.off()

I found some discussion of this from 2000 and 2001, but no explanation or
resolution, and I'm curious. Is there a reason for this behavior?

Thanks,
Sarah
-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list