[R] dev.print
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sat Mar 27 09:31:46 CET 2004
dev.print is designed for *print* devices which compute sizes in inches.
The help says
'dev.print' is most useful for producing a postscript print (its
default) when the following applies. Unless 'file' is specified,
the plot will be printed. Unless 'width', 'height' and
'pointsize' are specified the plot dimensions will be taken from
the current device, shrunk if necessary to fit on the paper.
...
So you asked for a plot of about 7 x 7, and jpeg expected points. Moral:
read the help page and specify width and height if it is not what you
expected.
On Fri, 26 Mar 2004, Dirk Eddelbuettel wrote:
> On Fri, Mar 26, 2004 at 09:25:02PM -0500, Scott Bartell wrote:
> > Shouldn't the following commands produce a nice jpeg file, or am I
> > missing something?
> >
> > hist(rnorm(1000))
> > dev.print(file="test.jpg",device=jpeg)
> [...]
> > R bug or my misunderstanding?
>
> The latter. The idiom is
>
> jpeg(file="/tmp/test.jpeg") # help help(jpeg) for defaults
> hist(rnorm(1000))
> dev.off() # important to close device
>
> i.e. you open a device (as this, or pdf(), png(), ...), do your plotting and
> then finalise matters by dev.off().
>
> A frequently belaboured issue is that several of the graphics format croak
> in 'headless' sessions without a $DISPLAY (e.g. for a webserver). They
> really do need a display to compute font metrics etc. The canonical way out
> is to the virtual display for which XFree86 has a special driver.
>
> Hth, Dirk
>
>
--
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