[R] Graphic window dimensions

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Apr 8 10:02:11 CEST 2013


On 08/04/2013 07:54, Eva Prieto Castro wrote:
>
> Hi Uwe,
>
> Thanks. At this point I need solve one doubt:
>
> If I use windows(width=8.27, height=11.69, rescale="fixed"), it shows the content in graphics window as real size, and a vertical scroll appears. How can I get it in Mac and Linux?. I mean, how can I get it in quartz() and X11()?.
>
> Moreover, I would need to identify in runtime the operating system and screen resolution, in order to know if I have to use rescale="fixed" or not. And I don't how to detect it.

See ?dev.new, ?.Platform and ?dev.size, and on a non-Windows box ?X11 
and ?quartz.  The 'screen resolution' isn't an unambiguous concept (some 
screens have non-square pixels, for example) and is not available 
directly at R level.  I do not see why you need it.  For an open 
graphics device comparing graphical parameters 'cin' and 'cra' may come 
close, but it is notional (you will get 72ppi on all Macs regardless of 
the hardware).

Note that your original question only makes sense on Windows: there is 
no 'copy to pdf' menu on X11(), and there is no resizing to fit on 
screen on quartz(): I just tried and A4 plot and the 'Save' menu item 
and it worked.

And on Windows the re-sizing only occurs when actually plotting: copying 
the plot to pdf replays the original plot instructions.

> Regards,
>
> Eva
>
> --- El dom, 7/4/13, Uwe Ligges <ligges at statistik.tu-dortmund.de> escribió:
>
> De: Uwe Ligges <ligges at statistik.tu-dortmund.de>
> Asunto: Re: [R] Graphic window dimensions
> Para: "Eva Prieto Castro" <evapcastro at yahoo.es>
> CC: r-help at r-project.org
> Fecha: domingo, 7 de abril, 2013 17:41
>
>
>
> On 07.04.2013 09:53, Eva Prieto Castro wrote:
>>
>> Hi Uwe,
>>
>> Thank you for your help. Then, how can I know (in runtime) then max
>> width and height I can use?. If it depends on the screen inches, I
>> should obtain those values in runtime, is this true?.
>>
>> The appearance in graphic window must be vertical (as A4 paper or
>> something like that), apart from the fact that the result of pdf created
>> must be the same as A4 paper.
>
> Well, since it rescales, I'd just open the screen as you proposed and use
>        dev.print(pdf, file="test.pdf", width=8.27, height=11.69)
> or whatever afterwards to copy *iff* you do not want to use the pdf
> device directly, which is recommended.
>
> Best,
> Uwe Ligges
>
>
>
>
>
>>
>> Regards,
>>
>> Eva
>>
>> --- El *dom, 7/4/13, Uwe Ligges /<ligges at statistik.tu-dortmund.de>/*
>> escribió:
>>
>>
>>       De: Uwe Ligges <ligges at statistik.tu-dortmund.de>
>>       Asunto: Re: [R] Graphic window dimensions
>>       Para: "Eva Prieto Castro" <evapcastro at yahoo.es>
>>       CC: r-help at r-project.org
>>       Fecha: domingo, 7 de abril, 2013 01:22
>>
>>
>>
>>       On 06.04.2013 08:53, Eva Prieto Castro wrote:
>>        > Dear all,
>>        >
>>        > I have a doubt: if I run windows(width=8.27,
>>        > height=11.69), the size of an A4 paper, does it work correctly in all
>>        > screens?
>>
>>       Correctly: yes, but not as you expect. It keeps the aspect ration
>>       but in
>>       a smaller size if the screen is smaller than the size you specified.
>>
>>
>>        >Or does it depend on the inches of my screen?.
>>
>>       Yes.
>>
>>
>>        > I ask
>>        > you about this question because I need to make the user see a
>>       graph in
>>        > the graph window and he must be able to save the graph as a pdf
>>       (using
>>        > the Rgui menu) and the result must be a pdf with A4 size.
>>
>>       Why not use pdf() directly?
>>
>>       Anyway, you can
>>          dev.print(pdf, file="test.pdf", width=8.27, height=11.69)
>>
>>       Best,
>>       Uwe Ligges
>>
>>
>>        > Thank you in advance.
>>        >
>>        > Regards,
>>        >
>>        > Eva
>>        >     [[alternative HTML version deleted]]
>>        >
>>        > ______________________________________________
>>        > R-help at r-project.org </mc/compose?to=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.
>>        >
>>
>
> 	[[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> 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



More information about the R-help mailing list