r - 如何在 levelplot 中调整 NA 值的颜色?
问题描述
我有一个光栅堆栈,我想使用 R 使用 rastervis 包中的 levelplot 绘制它。NA 值显示为灰色,由 panel.background=list(col='gray') 指定。但是,我想将 NA 值保持在德国白色边界之外。关于如何实现这一目标的任何建议?
这是我的代码:
levelplot(stack_hist, main="",
xlab=list("Longitude", cex=1), ylab=list("Latitude", cex=1),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
非常感谢你的帮助!
解决方案
推荐阅读
- oracle - Oracle:找出一个字符串中的最大数
- python - 使用 linux 或 python 格式化文本
- php - Yii2 WHERE IN 查询
- mysql - 如何从数据库中获取对象及其继承者?
- r - VAR模型中的错误
- ruby-on-rails - Rails has_one vs has_many 关联
- c++ - 不支持 GLSL 330 内核
- python - 尝试使用 python 在 Instagram 上注册:https://instagram.com/accounts/emailsignup
- javascript - 使用 svg 元素作为范围创建 d3.js 比例
- r - 套索射击和 glmnet 不同的结果