[R] colorkey: Placement of labels and ticks in center positions of "color key" of a levelplot ?

Zia Ahmed zua3 at cornell.edu
Wed Dec 23 20:44:52 CET 2009


Is it possible to place  labels  and ticks  in center positions of each 
cut of  "color key" of levelplot ? Here is my code that I used to 
produce a map (see attachment). The two  labels and ticks  were  placed  
in  left  sides each segment of the color key. I want to show them 
center of the cuts.
Help will be appreciated.
Thanks

Zia

# R code

data(meuse.grid)
coordinates(meuse.grid) = ~x+y
names(meuse.grid)

windows(width=4, height=5)
tiff( 
file="E:/Paper_Zia/Spatial_Variability/Paper_1/Output/Figures/Fig_1.tif",
width=4, height=5,units = "in", pointsize = 12, res=1600,
restoreConsole = T,compression =  "lzw",bg="transparent")

levelplot(ffreq~x+y, aspect="iso",
             xlab=list("E (m)",cex=.6), ylab="N (m)",
             scales=list(y=list(draw=T,cex=.7,rot=90, tck= 
.35),x=list(draw=T, cex=.7,tck= .35)),
              colorkey = list(space="right",tick.number=1,height=1, 
width=1.5,
              labels = list(at = seq(1,2,length=2),cex=.7,rot=90,
              lab = c("annual", "2-5 years"))),
# I want place above labels center of each cuts of colorkey"
              as.data.frame(meuse.grid),
              col.regions=gray.colors,cuts=1,
              panel = function(...) {
              panel.levelplot(...)
              panel.grid(h=-1, v=-1, col="darkgrey")
              #panel.text(2670600, 563000, cex=.7, " (c)")
              }, )
dev.off()


More information about the R-help mailing list