To get reproducible results, I highly recommend to print the lattice
graphics directly into the desired device, i.e. start the pdf >(or jpeg
or whatever) device before printing.
Best,
Uwe Ligges
Willem Vervoort wrote:
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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.