Hi,

I'm a novice with levelplot and need some assistance! Basically, I want a 
window 
which contains 6 levelplots of equal size presented in 3 columns and 2 rows. 


I've tried to approach it two ways. The first way leads to this question:

Is there any way to concatenate levelplots from a factor vertically as opposed 
to horizontally? I'd like to pair the levelplots by factor.2 on top of each 
other with the colorkey at thebottom, resulting in 3 columns of paired 
levelplots. I can only get 3 rows of paired levelplots. Here is some mock code 
to illustrate the point:

start = expand.grid(1:10,1:14)
start2 = rbind(start,start,start,start,start,start)
z = rnorm(840)
factor.1 = c(rep("A", 280), rep("B", 280), rep("C", 280))
factor.2 = c(rep("1", 140), rep("2", 140), rep("1", 140), rep("2", 140), 
rep("1", 140), rep("2", 140))

data = data.frame(start2, z, factor.1, factor.2)
names(data)[1:2] = c("x", "y")

data.A = data[data$factor.1 == "A",]
data.B = data[data$factor.1 == "B",]
data.C = data[data$factor.1 == "C",]

print(levelplot(z~x*y|factor.2,data.A,col.regions=heat.colors,asp="iso",xlab = 
"", ylab = "", colorkey = list(space="bottom"), 
scales=list(y=list(draw=F),x=list(draw=F))),split=c(1,1,1,3))
print(levelplot(z~x*y|factor.2,data.B,col.regions=topo.colors,asp="iso",xlab = 
"", ylab = "", colorkey = list(space="bottom"), 
scales=list(y=list(draw=F),x=list(draw=F))),split=c(1,2,1,3),newpage=FALSE)
print(levelplot(z~x*y|factor.2,data.C,col.regions=terrain.colors,asp="iso",xlab 
= "", ylab = "", colorkey = list(space="bottom"), 
scales=list(y=list(draw=F),x=list(draw=F))),split=c(1,3,1,3),newpage=FALSE)

My other approach has been to plot the 6 levelplots individually so that I can 
control the placement. However, I'd like to have the paired levelplots touch as 
they do in my first approach, and I'd like them to be the same size, despite 
having the colorkey only below one of the plots. Also, I'd like to put more 
space between the plot and the colorkey. Is there a way to manual control the 
size of the individual plot windows? Here is some additional code to illustrate 
this point:

data.A1 = data.A[data.A$factor.2 == "1",]
data.A2 = data.A[data.A$factor.2 == "2",]
data.B1 = data.B[data.B$factor.2 == "1",]
data.B2 = data.B[data.B$factor.2 == "2",]
data.C1 = data.C[data.C$factor.2 == "1",]
data.C2 = data.C[data.C$factor.2 == "2",]

print(levelplot(z~x*y,data=data.A1,col.regions=heat.colors,asp="iso",xlab = "", 
ylab = "",main="Method 
A",scales=list(y=list(draw=F),x=list(draw=F)),colorkey=FALSE),split=c(1,1,3,2))
print(levelplot(z~x*y,data=data.A2,col.regions=heat.colors,asp="iso",xlab = "", 
ylab = "", 
scales=list(y=list(draw=F),x=list(draw=F)),colorkey=list(space="bottom")),split=c(1,2,3,2),newpage=FALSE)

print(levelplot(z~x*y,data=data.B1,col.regions=topo.colors,asp="iso",xlab = "", 
ylab = "", main="Method 
B",scales=list(y=list(draw=F),x=list(draw=F)),colorkey=FALSE),split=c(2,1,3,2),newpage=FALSE)

print(levelplot(z~x*y,data=data.B2,col.regions=topo.colors,asp="iso",xlab = "", 
ylab = "", 
scales=list(y=list(draw=F),x=list(draw=F)),colorkey=list(space="bottom")),split=c(2,2,3,2),newpage=FALSE)

print(levelplot(z~x*y,data=data.C1,col.regions=terrain.colors,asp="iso",xlab = 
"", ylab = "", main="Method 
C",scales=list(y=list(draw=F),x=list(draw=F)),colorkey=FALSE),split=c(3,1,3,2),newpage=FALSE)

print(levelplot(z~x*y,data=data.C2,col.regions=terrain.colors,asp="iso",xlab = 
"", ylab = "", 
scales=list(y=list(draw=F),x=list(draw=F)),colorkey=list(space="bottom")),split=c(3,2,3,2),newpage=FALSE)


Any help would be greatly appreciated!

Ian
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to