【问题标题】:Changing the titles within a raster stack更改栅格堆栈中的标题
【发布时间】:2021-06-30 20:36:02
【问题描述】:

绘制时我创建了一个光栅堆栈,如下所示:

我想更改每个图表的标题,并为其添加一个主标题。

levelplot(rs, main = "MD13U0001", col.regions=rev(terrain.colors(6)), names.attr=c("LoCoH", "Elevation"))

当我尝试使用函数 levelplot 时,它给了我这个:

它将两个情节置于相同的比例,但给了我想要的与标题相关的内容。有没有更好的功能可以给我标题,但不能保持刻度分开?

【问题讨论】:

    标签: r plot raster r-raster


    【解决方案1】:

    示例数据

    library(raster)
    s <- stack(system.file("external/rlogo.grd", package="raster"))[[1:2]]
    

    设置图层名称和默认绘图

    names(s) <- c("Apple", "Mango")
    plot(s, cex.main=.8)
    

    一些自定义示例

    par(mar=c(3,3,5,5), mfrow=c(1,2))
    for (i in 1:2) {
        plot(s[[i]], cex.axis=.75, las=1)
        title(names(s)[i], line=0.5, cex.main=0.8)
    }
    text(-40, 100, "These are my maps", xpd=NA, cex=2)
    

    【讨论】:

      猜你喜欢
      • 2015-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-13
      • 1970-01-01
      • 2020-06-10
      • 1970-01-01
      相关资源
      最近更新 更多