[R] panel.text and saving to pdf
    Willem Vervoort 
    w.vervoort at usyd.edu.au
       
    Fri Jun 26 06:50:51 CEST 2009
    
    
  
Dear all,
I am not sure what I am doing wrong, but I have some unexplained behaviour when saving a lattice graph including text to a pdf file. The text seems to move around. It must have something to do with the way coordinates are set in devices other than jpg.
Any suggestions would be helpful
Willem
Here is some example code
setwd("c:/willem/research/misc")
today <- format(Sys.Date(),"%Y%m%d")
x <- runif(500)
y <- rnorm(500)
foo <- data.frame(x = x, y = y, z = rep(c("a","b"),250))
require(lattice)
xyplot(x~y|z,data=foo)
panel.text(370,470,"silly graph",cex=1.2,font=2)
savePlot(paste(today, "jpgplot",sep="_"),type="jpg") # this plots fine and text is as on the screen
savePlot(paste(today, "pdfplot",sep="_"),type="pdf") # text has moved
pdf(paste(today,"pdfplot2.pdf",sep="_")) # no difference using pdf
xyplot(x~y|z,data=foo)
panel.text(370,470,"silly graph",cex=1.2,font=2)
dev.off()
# There is also no difference 
               _                           
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          9.0                         
year           2009                        
month          04                          
day            17                          
svn rev        48333                       
language       R                           
version.string R version 2.9.0 (2009-04-17)
-----------------------------------------------------------------
Dr. R.W. Vervoort
McCaughey Senior Lecturer Hydrology and Catchment Management
Faculty of Agriculture, Food and Natural Resources,
Bldg A04, The University of Sydney, NSW 2006
http://tinyurl.com/mccaughey
http://blogs.usyd.edu.au/waterhydrosu
ph: +61 2 9351 8744
fax: +61 2 9351 4953
    
    
More information about the R-help
mailing list