[R] Generating EPS figures automatically (like Sweave)

Dieter Menne dieter.menne at menne-biomed.de
Wed Apr 1 09:10:26 CEST 2009


eariasca <eariasca <at> math.ucsd.edu> writes:

> Is there a way to generate EPS figures automatically out of a chunk  
> of code?  Basically, I would like to do something like Sweave does (I  
> just find it a little cumbersome to create a .Rnw file and then keep  
> track of the figure numbering).  

I normally use this type of code when not using Sweave

ToPostscript = TRUE
if (ToPostscript){
  trellis.device("postscript",file="myfile.ps",width=6,height=4,color=FALSE)
} else
{
  windows( height=4,width=6)
}
# Do the plot-works

if (ToPostscript){
  dev.off()
  sink()
}


## And use GhostFriend from 
http://www.noliturbare.com/ReadGhostFriend.htm 
to create TIFF if your publisher asks for it.




More information about the R-help mailing list