【发布时间】:2021-02-13 23:45:30
【问题描述】:
我想更改图例的数字而不更改 tmap 中的比例。
举个例子:
r <- raster::raster(matrix(runif(100), 10, 10))
tm_shape(r) +
tm_raster(legend.is.portrait = FALSE, style = 'cont', title = '', palette = "-RdBu") +
tm_layout(frame = FALSE, legend.outside = TRUE, legend.outside.position = "bottom")
给我们一个看起来像这样的传说:
我们可以像这样改变 tm_raster 调用中的中断:
tm_shape(r) +
tm_raster(legend.is.portrait = FALSE, style = 'cont', title = '', palette = "-RdBu",
breaks = pretty(cellStats(r, range), 3),) +
tm_layout(frame = FALSE, legend.outside = TRUE, legend.outside.position = "bottom")
这给了我们一个看起来与第一个不同的传说:
我想做的是在第一个示例中绘制图例,但标签只有 0.2、0.5 和 0.8。
【问题讨论】: