[R] Plot to postscript in function

Marco Albani malbani at fas.harvard.edu
Tue Jan 28 19:27:03 CET 2003


Thanks to Prof. Ripley,

this version of the fucntion works as expected

 > BbEh.graphs2eps
function(the.data){
#function to plot all sort of cohort information to
#a single eps for storage and future printing or display

pippo <- deparse(substitute(the.data))
thefile <- paste(c("../ed/",pippo,"/",pippo,".eps"),collapse = "")
postscript(file= thefile, paper = "letter")
lset(my.lts)
#plot cohort variables
print(BbEh.xyplot.dbh(the.data))

#plot allometry checks
print(BbEh.xyplot.hVSdbh(the.data))

dev.off(dev.cur())

}

The use of postscript() instead of trellis.device() to open the device 
doesn't seem to be a problem.

Thanks to everyone who answered me.

Marco




ripley at stats.ox.ac.uk wrote:


> You appear to be using lattice commands to plot on a postscript device: 
> you should be using a trellis.device.
> 
> Also, you do need to *print* lattice commands, and I guess you are
> not doing so in the custom commands which you are not showing us.
> Wre those calls to zyplot, they would not work unless surrounded by 
> print().
> 
> Please be careful to distinguish the use of lattice from `plotting',
> as the details are where I suspect the problem arises.
> 

-- 
Marco Albani, Ph.D.
Postdoctoral Fellow
Dept. of Organismic and Evolutionary Biology
Harvard University
HUH 22 Divinity Avenue
Cambridge, MA
02138-2094 USA

Tel: +1 617 495 1621
Fax: +1 617 495 9484

http://www.people.fas.harvard.edu/~malbani




More information about the R-help mailing list