我想在 colorkey 参数中定义颜色中断、颜色条的位置。我尝试过使用以下内容:
library(raster)
library(rasterVis)
p.at =seq( 1.160766 ,3.554995 ,length.out = 17)# I have 16 colors breaks
p.at=round(p.at,digits = 1)# min and max of all datasets
#Moreover, if you want to define where the labels are located define the components of colorkey:
Labels<-list(at=p.at)
Colorkey <- list(at=at,labels=Labels)## where the colors change ## where to print labels
themes <- rasterTheme(region=brewer.pal(11,'RdYlBu'))
s <- stack(Precip_JJA,Precip_JJAsim)# two datasets
#x.scale=list(cex=1, alternating=1, col='black')
#y.scale=list(cex=1, alternating=1, col='black')
#scales=list(x=x.scale, y=y.scale)
Precip_plot<-levelplot(s, layout=c(2, 1), index.cond=list(c(1, 2)),par.settings=themes,scales=list(x=list(draw=FALSE)),
margin=FALSE,xlab=NULL,par.strip.text=list(cex=0),
colorkey = list(space = "bottom",labels = list(cex=1,at = p.at),lab = p.at))
Precip_plot
问题:标签与颜色中断不完全对齐。见上图。我的代码有问题吗?
非常感谢,aez。