如何在levelplot中调整NA值的颜色?

问题描述

我有一个光栅堆栈,我想用 R 的 rastervis 包中的 levelplot 绘制它。NA 值显示为由 panel.background=list(col='gray') 指定的灰色。但是,我想在德国白人边界之外保持 NA 值。有关如何实现这一目标的任何建议?

这是我的代码

levelplot(stack_hist,main="",xlab=list("Longitude",cex=1),ylab=list("Latitude",layout=c(2,2),names.attr=c("A","B","C","D"),par.strip.text= list(cex=1,lines=1),colorkey=list(at=as.numeric(factor( c( seq(10,180,by=10)))),labels=as.character( c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18")),col=c(color)),par.settings=list(strip.border=list(col='transparent'),strip.background=list(col='transparent'),axis.line=list(col='transparent'),panel.background=list(col='gray') ),scales=list(draw=F,x=list(cex=1),y=list(cex=1)),col.regions=color,at=my.at)+
      layer(sp.polygons(Ger_Bundesland,col = 'grey90')) +
      layer(sp.polygons(Ger_Land,col = 'grey95')) ## add polygon layer

这就是这个图目前的样子:

enter image description here

非常感谢您的帮助!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)