【发布时间】:2023-01-12 00:52:27
【问题描述】:
我正在根据 INLA 预测创建一个情节。一切都非常适合建模,但对于情节,图上的图例是点(如https://gis.stackexchange.com/questions/350918/how-do-i-reverse-spplot-colour-key-so-the-values-are-decreasing)而不是比例尺(如此处http://www.nickeubank.com/wp-content/uploads/2015/10/RGIS3_MakingMaps_part1_mappingVectorData.html):
这是我想更改的代码。我想有一个因素(R spplot: colorbar rather than legend for SpatialPoint data,spplot issue with legend range and colors distribution)的问题,但我不明白如何/改变什么:
m_grid <- inla(formWITHOUT, data = inla.stack.data(region.stack.predGrid, spde = inlaSetting$region.spde),
family = "gamma",
control.predictor = list(A = inla.stack.A(region.stack.predGrid), compute = TRUE, link=1),
control.compute = list(cpo = TRUE, dic = TRUE),
control.family=list(link="default"))
summary(m_grid)
index.pred <- inla.stack.index(region.stack.predGrid, "region.pred")$data
region.grid_sf$Sbiomass <- m_grid$summary.fitted.values[index.pred, "mean"]
region.grid_sf$Sbiomass_sd <- m_grid$summary.fitted.values[index.pred, "sd"]
my.palette <- brewer.pal(n = 7, name = "OrRd")
par(mar = c(0,0,0,0))
spplot(region.grid_sf, c("Sbiomass"), col.regions = my.palette, col = "transparent")
提前感谢任何提示!
【问题讨论】:
-
似乎 (edzer.github.io/sp/#using-lattice-plot-spplot) 图例将使用点符号表示空间点,并使用所需的颜色条表示栅格或多边形。您可以尝试将点数据转换为栅格(例如通过克里金法)或多边形(例如 Voronoi 或矩形网格)。
-
谢谢 !我会尽力让你知道!
-
实际上答案比我想的更简单:添加“colorkey =T”作为参数:D
-
您能否将其作为您自己问题的答案并将其标记为“已接受的答案”(以便未来的用户可以将其识别为已解决的问题)?谢谢! :-)