How can I plot a continents map with R?

前端 未结 3 1099
傲寒
傲寒 2021-01-04 14:34

There are many solutions to plot maps at country level, but in my case I want to print statistics at continent level.

The only thing that comes into my mind is to us

3条回答
  •  感情败类
    2021-01-04 15:03

    library(sp) #Load your libraries
    library(maptools)
    #Download the continents shapefile
    download.file("http://baruch.cuny.edu/geoportal/data/esri/world/continent.zip",
                  "cont.zip")
    #Unzip it
    unzip("cont.zip")
    #Load it
    cont <- readShapeSpatial("continent.shp")
    #Plot it
    plot(cont,
         col=c("white","black","grey50","red","blue","orange","green","yellow")) 
    #Or any other combination of 8 colors
    

    enter image description here

提交回复
热议问题