[R] Scaling lattice tiffs

Dieter Menne dieter.menne at menne-biomed.de
Tue Aug 19 10:52:20 CEST 2008


Dear ListeRs,

Since I normally produce output by Sweave, I never had to care about pixel
resolution. Now someone asked me for 600dpi tiffs of lattice.

I did not find an easy way to simply scale a tiff-image that looks good in
default display. See example below.

Dieter


library(lattice)

p = xyplot(Sepal.Length + Sepal.Width ~ Petal.Length + Petal.Width |
Species, 
       data = iris)

# looks good, but low resolution
trellis.device("tiff",file="a.tif")
print(p)
dev.off()

# do I really have to scale all fonts to get this right?
trellis.device("tiff",file="a1.tif",res=600,width=6000,height=4000)
print(p)
dev.off()



More information about the R-help mailing list