Re: [Rd] invalid graphics state using dev.print (fwd)

From: Hin-Tak Leung <hin-tak.leung_at_cimr.cam.ac.uk>
Date: Tue 21 Feb 2006 - 14:51:06 GMT

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)

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

HTL



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Feb 22 01:51:24 2006

This archive was generated by hypermail 2.1.8 : Tue 21 Feb 2006 - 22:34:55 GMT