【发布时间】:2021-12-21 15:29:03
【问题描述】:
如何平滑使用 ggplot 和 sf 生成的地图的多边形?
我使用 sf 包从 shapefile 中提取多边形
geomunicipios <- st_read("ruta/archivo.shp")
Reading layer `archivo' from data source
`ruta\archivo.shp'
using driver `ESRI Shapefile'
Simple feature collection with 45 features and 10 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: -2.344411 ymin: 37.37375 xmax: -0.647983 ymax: 38.75509
Geodetic CRS: WGS 84
和 ggplot2 绘制地图:
rmurcia <- ggplot(data = geomunicipios) +
geom_sf(aes(fill=columna),color="#FFFFFF",size=1)
【问题讨论】:
-
See here 关于制作一个更易于人们帮助的可重现示例。如果没有您的 shapefile 或其他任何会重现问题的内容,我们将无法运行您的任何代码,并且您还没有发布任何输出,因此不清楚您正在使用什么以及哪些不起作用
-
下载地址:centrodedescargas.cnig.es/CentroDescargas/index.jsp - Información geográfica de referencia - Límites urbanes, Provinciales y autonómicos - Descargar - lineas_limite.zip。以及未压缩文件夹中的路径:SIGLIM_Publico_INSPIRE - SHP_ETRS89 - recintos_municipales_inspire_peninbal_etrs89 - recintos_municipales_inspire_peninbal_etrs89.shp