R语言geoviz包,ggslippy#创建图层添加到“ggplot2”图表
# Tue Mar 16 10:01:11 2021 -
# 字符编码:UTF-8
# R 版本:R x64 4.0.4 for window 10
# cgh163email@163.com
# 个人笔记不负责任,拎了个梨🍐
.rs.restartR()
require(geoviz)
rm(list = ls());gc()
?ggslippy#创建图层添加到“ggplot2”图表
library(ggplot2)
dem <- example_raster()
dem <- raster::aggregate(dem, 10) #聚合以加快ggplot进行测试
gg_overlay_image <- slippy_overlay(
dem,
image_source = "stamen",
image_type = "watercolor",
return_png = FALSE,
max_tiles = 2
)
ggplot() +
ggslippy(gg_overlay_image, set_coord_equal = FALSE)
ggsave(filename = '创建图层添加到“ggplot2”图表.jpg',dpi=300)