使用Terra增加轴,传奇和标题的栅格标签大小

发布于 2025-02-12 20:35:13 字数 684 浏览 0 评论 0原文

如何使用Terra软件包增加传奇断裂,轴和情节标题标签的大小。 下面创建的图具有如此小的标签,我根本无法阅读它们。

r1 <- rast(ncol=10, nrow=10, xmin=-150, xmax=-80, ymin=20, ymax=60)
r2 <- rast(ncol=10, nrow=10, xmin=-150, xmax=-80, ymin=20, ymax=60)
r3 <- rast(ncol=10, nrow=10, xmin=-150, xmax=-80, ymin=20, ymax=60)

values(r1) <- runif(ncell(r1))
values(r2) <- runif(ncell(r2))
values(r3) <- runif(ncell(r3))

rr <- c(r1, r2, r3)

png(file.path(dir_ls$input, '250k', 'output', paste0(year_ref,'_map.png')),
    width = 1000, height = 800)

terra::plot(rr,
            type = "continuous",
            range = c(0,1),
            nr = 3,
            main = c("r1","r2","r3"))
dev.off()

How can I increase the size of labels of legend break, axis and plot title using terra package.
The plot created below has such small labels that I can't read them at all.

r1 <- rast(ncol=10, nrow=10, xmin=-150, xmax=-80, ymin=20, ymax=60)
r2 <- rast(ncol=10, nrow=10, xmin=-150, xmax=-80, ymin=20, ymax=60)
r3 <- rast(ncol=10, nrow=10, xmin=-150, xmax=-80, ymin=20, ymax=60)

values(r1) <- runif(ncell(r1))
values(r2) <- runif(ncell(r2))
values(r3) <- runif(ncell(r3))

rr <- c(r1, r2, r3)

png(file.path(dir_ls$input, '250k', 'output', paste0(year_ref,'_map.png')),
    width = 1000, height = 800)

terra::plot(rr,
            type = "continuous",
            range = c(0,1),
            nr = 3,
            main = c("r1","r2","r3"))
dev.off()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假装不在乎 2025-02-19 20:35:14

这样:

terra::plot(rr,
            type = "continuous",
            range = c(0,1),
            nr = 3,
            main = list("r1","r2","r3"),
            plg=list( # parameters for drawing legend
                title = "Legend title",
                title.cex = 2, # Legend title size
                cex = 2 # Legend text size
            ),
            pax=list( # parameters for drawing axes
                cex.axis = 2 # Axis text size 
            ), 
            cex.main = 2 # Title text size
            )

我花了一点猜测工作才能确定在哪里放置cex.main,因为它似乎没有记录在 docs

Like this:

terra::plot(rr,
            type = "continuous",
            range = c(0,1),
            nr = 3,
            main = list("r1","r2","r3"),
            plg=list( # parameters for drawing legend
                title = "Legend title",
                title.cex = 2, # Legend title size
                cex = 2 # Legend text size
            ),
            pax=list( # parameters for drawing axes
                cex.axis = 2 # Axis text size 
            ), 
            cex.main = 2 # Title text size
            )

It took a bit of guess work on my part to work out where to put cex.main as it does not seem to be documented but there is a list of other parameters in the docs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文