Reputation: 61
I am trying to plot a world map with longitude coordinates 0, 360. When i do so, either longitude points start from mid-map, or the projection of the map is thrown off. Here is an example:
ggplot() +
geom_polygon(data = world_map, aes(x=long, y = lat, group=group)) +
coord_fixed(1.3) + coord_equal(xlim = c(0, 360), ylim = c(-90, 90))
I would like for the longitude to read 0 to 360 with the full map projection.
Upvotes: 1
Views: 2398
Reputation: 1037
You can use the "world2" map from the maps package, which has range [0,360]: ggplot() + geom_polygon(data = fortify(maps::map("world2",plot=FALSE,fill=TRUE)), aes(x=long, y = lat, group=group)) + coord_fixed(1.3) + coord_equal(xlim = c(0, 360), ylim = c(-90, 90))
Alternatively, if you want the freedom to have any shift of the map, maps v3.2.0 (just uploaded to CRAN) will allow you to do
myworld = maps::map(wrap=c(0,360), plot=FALSE, fill=TRUE)
ggplot() +
geom_polygon(data = fortify(maps::map("world2",plot=FALSE,fill=TRUE)), aes(x=long, y = lat, group=group)) +
coord_fixed(1.3) + coord_equal(xlim = c(0, 360), ylim = c(-90, 90))
Upvotes: 1