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

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon, 21 Jul 2008 12:26:33 +0100 (BST)

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

______________________________________________
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.
Received on Mon 21 Jul 2008 - 11:29:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 Jul 2008 - 11:32:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive