gpt4 book ai didi

r - 在 levelplot 中移动 colorbar/colorkeys 的位置

转载 作者:行者123 更新时间:2023-12-04 10:43:53 24 4
gpt4 key购买 nike

我已经使用函数“levelplot”脚本绘制了一堆光栅,如下所示:

library(raster)
library(rasterVis)
ras <- list.files("/filepath/", pattern = "\\.tif$", full=TRUE)
s <- stack(ras)
> levelplot(s, colorkey = list(space ="bottom",height=1, width=1),
names.attr=c("2011","2012","2013", "2014")))

Figure of Levelplot

绘图的问题在于 x 轴标签“经度”的标签与绘图的颜色条/颜色键重叠。是否可以将颜色键的位置移动到标签“经度”下方一点?

谢谢

最佳答案

您可以使用 vjust 进行调整xlab 中的参数列表 ...

levelplot(s, colorkey = list(space = "bottom", height = 1, width = 1),
names.attr = c("2011", "2012", "2013", "2014"),
xlab = list(label = "Longitude", vjust = -.2)))

之前(带有虚拟数据):
enter image description here

之后:
enter image description here

关于r - 在 levelplot 中移动 colorbar/colorkeys 的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59805140/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com