[R] Graphics device size

Christos Hatzis christos at silicoinsights.com
Tue Apr 11 22:23:32 CEST 2006


Actually it does.
Thank you, Prof. Ripley. 

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] 
Sent: Tuesday, April 11, 2006 1:26 PM
To: Christos Hatzis
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Graphics device size

On Tue, 11 Apr 2006, Prof Brian Ripley wrote:

> On Tue, 11 Apr 2006, Christos Hatzis wrote:
>
>> Dear All,
>>
>> When working with composite plots many times I have to manually 
>> adjust the graphics display window size to get the best results (in 
>> Windows XP).  I can then find the size of the adjusted window in inches
using par("din").
>>
>> Now I would like to export the adjusted graphs as png's and have them 
>> look as close to the original display as possible.  The problem is 
>> that the png device accepts size arguments in pixels so that I need 
>> to convert inches to pixels.  Is there a way to get the default 
>> pixels-per-inch that the windows device uses?  RSiteSearch("ppi") did not
return any helpful hints.
>
> Well, yes, but only by calling the Win API for your own C code.  It is 
> often not very accurate.  Interestingly, it is actually in pixels per cm.
>
> What is harder is to do is to find out how large you have resized the 
> graphics window to.  Since in fact that is stored in pixels, you don't 
> need the pixels-per-inch, but I can see no way to do this without C 
> code (the info is both in the private structure defined in 
> devWindows.h and in the device-driver structure via right - left, bottom -
top).

Doesn't savePlot(, type="png") do everything that you might want here?

-- 
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