微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决如何在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 举报,一经查实,本站将立刻删除。