简体   繁体   中英

Map projection with longitude values 0-360

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.

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))

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM