[R] dev.print

Dirk Eddelbuettel edd at debian.org
Sat Mar 27 03:35:52 CET 2004


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	

-- 
The relationship between the computed price and reality is as yet unknown.  
                                             -- From the pac(8) manual page




More information about the R-help mailing list