From ripley at stats.ox.ac.uk  Tue Feb 21 15:55:04 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 21 Feb 2006 14:55:04 +0000 (GMT)
Subject: [Rd] invalid graphics state using dev.print (fwd)
In-Reply-To: <43FB28DA.4080708@cimr.cam.ac.uk>
References: <Pine.OSF.4.58.0602081515590.512812@wotan.mdacc.tmc.edu>
	<17388.51930.273876.336070@stat.math.ethz.ch>
	<43F92420.4070706@stat.auckland.ac.nz>
	<Pine.LNX.4.64.0602200714030.3798@gannet.stats.ox.ac.uk>
	<Pine.LNX.4.64.0602200833030.4588@gannet.stats.ox.ac.uk>
	<43FB28DA.4080708@cimr.cam.ac.uk>
Message-ID: <Pine.LNX.4.64.0602211447310.9240@gannet.stats.ox.ac.uk>

On Tue, 21 Feb 2006, Hin-Tak Leung wrote:

> Prof Brian Ripley wrote:
>> On Mon, 20 Feb 2006, Prof Brian Ripley wrote:
>> 
>>> On Mon, 20 Feb 2006, Paul Murrell wrote:
> <snipped>
>>>>>  >> x11()
>>>>>  >> plot(rnorm(10))
>>>>>  >> dev.print(png)
> <snipped>
>>> I don't think there is a way to do that unambiguously (there is no
>>> standard way to do the conversion), and in any case dev.print() was passed
>>> a function, not the name of a function, and so does not in general know
>>> how it behaves (and your 'png' need not be R's png()).
>
> There is a "standard" way of querying the X display directly about
> the size each pixel supposedly represents - well, an X display can
> be configured wrongly, etc, but you get what you ask for...
>
> $ xdpyinfo |grep 'resolution'
>  resolution:    75x75 dots per inch
>
> (this 75x75 seems to be a default value as I did not set it anywhere,
> but I believe it is configurable)

Yes, but this is png, not X11.  The resolution of your X11 screen is 
unrelated to a .png file you might produce.

> I am not sure about png files, but tiff files also have internal data
> claiming x pixels corresponds to y inches. (and I am fairly sure jpeg
> does *not* have this feature).

Reading the help page for the R devices will enlighten you.  (Really, you 
should do so before posting as we do ask.)  An assumption of 72ppi is 
quite common, but so are 180 and 300.

The png/jpeg devices now tell careless users that small width/height 
values are probably a mistake.

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



[Rd] invalid graphics state using dev.print (fwd)
Prof Brian Ripley