[R] positioning of color key in levelplot

From: E C <mmmraspberries_at_hotmail.com>
Date: Sun, 11 May 2008 15:08:06 -0400


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_at_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. Received on Sun 11 May 2008 - 19:10:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 11 May 2008 - 21:31:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive