您的位置:首页 > 科技 > 能源 > 福州网站制作哪里好_免费的crm系统推荐_培训心得体会300字_关键词排名零芯互联关键词

福州网站制作哪里好_免费的crm系统推荐_培训心得体会300字_关键词排名零芯互联关键词

2024/10/7 4:24:54 来源:https://blog.csdn.net/H20230717/article/details/142489594  浏览:    关键词:福州网站制作哪里好_免费的crm系统推荐_培训心得体会300字_关键词排名零芯互联关键词
福州网站制作哪里好_免费的crm系统推荐_培训心得体会300字_关键词排名零芯互联关键词

在这里插入图片描述

ggplot2语法的空间图形画图

Spatial data plus the power of the ggplot2 framework means easier mapping.

加载R包

# install.packages("ggspatial")library(ggplot2)
library(ggspatial)
load_longlake_data()

Using layer_spatial() and annotation_spatial()

ggplot() +annotation_spatial(longlake_waterdf) +layer_spatial(longlake_depthdf, aes(col = DEPTH_M))

在这里插入图片描述

With raster layers, you can also use layer_spatial()

ggplot() + layer_spatial(longlake_depth_raster, aes(fill = after_stat(band1))) +scale_fill_viridis_c(na.value = NA)

在这里插入图片描述

Using north arrow and scalebar

ggplot() +annotation_spatial(longlake_waterdf) +layer_spatial(longlake_depthdf, aes(col = DEPTH_M)) +annotation_scale(location = "tl") +annotation_north_arrow(location = "br", which_north = "true")

在这里插入图片描述

Tile map layers

ggplot() +annotation_map_tile(type = "osm") +layer_spatial(longlake_depthdf, aes(col = DEPTH_M))

在这里插入图片描述

Data frames with coordinates

cities <- data.frame(x = c(-63.58595, 116.41214), y = c(44.64862, 40.19063), city = c("Halifax", "Beijing")
)ggplot(cities, aes(x, y)) +annotation_map_tile(type = "stamenwatercolor") +geom_spatial_point() +geom_spatial_label_repel(aes(label = city), box.padding = 1) +coord_sf(crs = 3995)

在这里插入图片描述

案例

library(ggplot2)
library(ggspatial)
load_longlake_data()ggplot() +# loads background map tiles from a tile sourceannotation_map_tile(zoomin = -1) +# annotation_spatial() layers don't train the scales, so data stays centralannotation_spatial(longlake_roadsdf, size = 2, col = "black") +annotation_spatial(longlake_roadsdf, size = 1.6, col = "white") +# raster layers train scales and get projected automaticallylayer_spatial(longlake_depth_raster, aes(colour = after_stat(band1))) +# make no data values transparentscale_fill_viridis_c(na.value = NA) +# layer_spatial trains the scaleslayer_spatial(longlake_depthdf, aes(fill = DEPTH_M)) +# spatial-aware automagic scale barannotation_scale(location = "tl") +# spatial-aware automagic north arrowannotation_north_arrow(location = "br", which_north = "true")

在这里插入图片描述

参考

  • https://paleolimbot.github.io/ggspatial/articles/ggspatial.html

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com