I don't see why you think it is 'odd'. par() is working with the
current
working copy of the internal pars, and that is only updated when you plot.
It refers to the current state of the device.
At least if the display list is turned on, a screen device will replot
when it is resized, obviously if there is a plot present.
If you are trying to do computations for a plot, call plot.new() first.
On Fri, 18 Jul 2008, Sarah Goslee wrote:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
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