已解决:如何消除 ggplot 绘制局部世界地图时出现的冗余横线和色块?
完美解决方案来啦:用 coord_quickmap()
:
p + coord_quickmap(xlim = lr)
同时满足了我的三个要求:无冗余色块,经纬度均匀,展示随意指定经纬度范围。
dapengde 更改标题为「已解决:如何消除 ggplot 绘制局部世界地图时出现的冗余横线和色块?」
dapengde 顺便补充一下二者区别,来自帮助文档 ?coord_quickmap
coord_map
projects a portion of the earth, which is approximately spherical, onto a flat 2D plane using any projection defined by the mapproj package. Map projections do not, in general, preserve straight lines, so this requires considerable computation.coord_quickmap
is a quick approximation that does preserve straight lines. It works best for smaller areas closer to the equator.