[R] lattice multiple plots per page

Jeff Jorgensen jcjorgensen at wisc.edu
Tue Feb 15 01:12:20 CET 2005


Dear R-sters,

I was wondering if anyone has encountered the following issues.  I've 
figured out how to get multiple levelplots [library(lattice)] on a single 
plot.  However, when I add text (adding axis labels for the entire four 
panel plot) the text is missing when I insert the *.eps file I've created 
into my LaTeX document (via MikTeX-WinEdt).  And, I've just upgraded to R 
v2.0.1 from v1.8.1 (Windows), and each individual levelplot is smaller 
compared to the older R release.

Any clues as to 1) how I can recover the lost text, and 2) increase the 
size of each of the levelplots?

Cheers,

Jeff Jorgensen

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sample code that illustrates what I'm trying to do:

#create a levelplot
x<-seq(pi/4, 5*pi, length = 100)
y<-seq(pi/4, 5*pi, length = 100)
r<-as.vector(sqrt(outer(x^2, y^2, "+")))
grid<-expand.grid(x=x, y=y)
grid$z<-cos(r^2) * exp(-r/(pi^3))
a<-levelplot(z~x*y, grid, cuts = 50, xlab="", ylab=",
		colorkey = FALSE)

#create the multiple panel plot, here using all the same levelplot
trellis.par.set(list(background=list(col="white"))) #white background
#using position to scale the plots up and to the right ~10%
#to make room for the axis labels
print(a,position=c(0.1,0.1,1,1),split=c(1,1,2,2),more=T)
print(a,position=c(0.1,0.1,1,1),split=c(1,2,2,2),more=T)
print(a,position=c(0.1,0.1,1,1),split=c(2,1,2,2),more=T)
print(a,position=c(0.1,0.1,1,1),split=c(2,2,2,2),more=F)
#commands that let you click where you want the labels centered
ltext(grid::grid.locator(),lab="x-axis label, where I click",cex=1.5)
ltext(grid::grid.locator(),lab="y-axis label, where I click",cex=1.5,srt=90)
#save device to an *.eps file, to be called later by a \includegraphics command
dev.copy2eps(file="twobytwoplot.eps")



-------------- next part --------------

---





More information about the R-help mailing list