Hi David,
Thank you for your advice. I have just figured why neither the
suggestion of 'par("din")' or "dev.size()" works for me. Having
specified 'rescale="fixed"' in a preceding windows() command seems to
prevent R from reporting the current window size. See here:
windows(width=7.5,height=6,rescale="fixed",xpos=0,title="Equation
window")
As a result, par("din") and dev.size() continued to report the width
and height specified in the windows() command. I specified the 'fixed'
option for rescale to enable scrollbars for the plot. However, it seems
by doing so I can no longer save the modified window size for later use
when my function is called again. I wonder if there is anyway that I can
obtain the current window size while rescale is set to 'fixed'.
Thank you for your advice again.
Best, Edmond
>>> David Winsemius <[email protected]> 15/02/10 15:05 >>>
On Feb 15, 2010, at 9:49 AM, <[email protected]> wrote:
> Dear Prof Ripley,
> Thank you very much for your advice. In fact, I have already tried
> 'par("din")'. It does not seems to pick up the changes made to the
> window. For example, I issued the par command after the plot:
>
>> par("din")
> [1] 7.5 7.0
> [changed window size]
>
>> par("din")
> [1] 7.5 7.0
> The result is exactly the same after changes made to the window.
> Thanks
> again.
Try plotting after changing the size and re-querying "din":
> par("din")
[1] 7 7
<change window size>
> par("din")
[1] 7 7
> plot(1,1)
> par("din")
[1] 3.940054 7.268841
<change window size again, but no replotting>
> par("din")
[1] 7.144498 4.899888
--
David.
>
> Best wishes,
> Edmond
>
>>>> Prof Brian Ripley <[email protected]> 15/02/10 14:35 >>>
> On Mon, 15 Feb 2010, [email protected] wrote:
>
>> Dear R-listers,
>>
>> I am writing a function that will generate a simple plot for the
>> user . The size of the window (that contains the plot) may not be
>> what the user wants.
>>
>> Supposing the user adjusts the window to a size of her/his choice,
I
>
>> would like to be able to save the new window size and specify the
>> plot to be of this new window size when the user calls my function
>> again. My question is what is the kind of 'get' or save graphic
>> parameter command that I need to extract the size of the current
>> window? I have looked at 'par' and 'getOption' but they don't seem
>> to what I need.
>
>> From the help for par:
>
> ÌdinÌ _*R.O.*_; the device dimensions, Ì(width,height)Ì, in
> inches.
>
> seems to be exactly what you are asking for.
>
> (I'd be cautious about saving this across sessions: users may well
use
>
> R on different computers with a common file system.)
>
>> Many thanks for any advice in advance.
>>
>> Best wishes,
>> Edmond
>>
>>
>>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++
>> Edmond Ng, MSc CStat
>> Lecturer in Medical Statistics
>> Health Services Research Unit, London School Hygiene & Tropical
> Medicine, Keppel Street, London WC1E 7HT, UK
>> Tel: +44 (0)20 7927 2366 (direct line: ext 2065) Fax: +44 (0)20
7580
> 8183
>> (Room 35, Ground Floor, Malet Street side)
>> Website: http://www.lshtm.ac.uk/hrsu
>>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++
>
> --
> Brian D. Ripley, [email protected]
> 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
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] 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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.