R中地图投影中不需要的水平线
几行代码来暴露我的问题。当我使用地图时 世界和我介绍了一个投影,我总是以一些 奇怪的水平线。 请看一看 从这里我举了新泽兰的例子R中地图投影中不需要的水平线,r,ggplot2,R,Ggplot2,几行代码来暴露我的问题。当我使用地图时 世界和我介绍了一个投影,我总是以一些 奇怪的水平线。 请看一看 从这里我举了新泽兰的例子 library(ggplot2) nz <- map_data("nz") # Prepare a map of NZ nzmap <- ggplot(nz, aes(x = long, y = lat, group = group)) + geom_polygon(fill = "white", colour = "black") # Plot i
library(ggplot2)
nz <- map_data("nz")
# Prepare a map of NZ
nzmap <- ggplot(nz, aes(x = long, y = lat, group = group)) +
geom_polygon(fill = "white", colour = "black")
# Plot it in cartesian coordinates
nzmap
# With correct mercator projection
nzmap + coord_map()
库(ggplot2)
nz这是ggplot中非常常见的问题,但令人高兴的是,它很容易解决:
世界地图+合作地图(xlim=c(-180180))
产生
解决方案来源:请发布图片。此外,不能将https://与该链接一起使用,因为其证书无效。据了解,这是一个已知的问题,但没有计划修复它,因为创建者更倾向于使用更好的数据源
world <- map_data("world")
# Prepare a map of the world
worldmap <- ggplot(world, aes(x = long, y = lat, group = group)) +
geom_polygon(fill = "white", colour = "black")
# Plot it in cartesian coordinates
worldmap
##but the following is a disaster!
# With correct mercator projection
worldmap + coord_map()