Is there a way of positioning the color key in levelplot when the axes are on a 
categorical (rather than numerical) scale? I've put some sample code below. I 
need to add a secondary y axis to the right side of my plot but then the labels 
interfere with the color key (which is currently on the right side). Is there a 
way to shift the color key over a bit more to the right? I've tried playing 
around with the arguments "x", "y", and "corner"in the colorkey list, but it 
doesn't seem to change anything. I've also tried putting the colorkey on the 
left side instead, but then the secondary y axis labels are cut-off. Thanks for 
any help!

group1 <- c(rep("A1", 40), rep("A2", 40))
group2 <-rep(c(rep("C1", 5), rep("C2", 5), rep("C3", 5), rep("C4", 5), 
rep("C5", 5), rep("C6", 5), rep("C7", 5), rep("C8", 5)),2)
num <- rnorm(80)
group3 <- rep(seq(0,4,1),16)
data <- data.frame(group1, group2, num, group3)

levelplot(num ~ as.factor(group3) * group2|group1, 
data=data,col.regions=rev(heat.colors(25)),
            colorkey=list(space="right"), region=T, layout=c(1,2), 
scales=list(y=list(alternating=c(1,1,1))))             

trellis.focus("panel", 1, 2, clip.off=T)
panel.axis(at=seq(1,8,1), labels=c(rep("Blah",8)), side=c("right"), outside=T)
trellis.focus("panel", 1, 1, clip.off=T)
panel.axis(at=seq(1,8,1), labels=c(rep("Blah",8)), side=c("right"), outside=T)
trellis.unfocus()

_________________________________________________________________


        [[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