Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ggplot2 + world map = old data?

Tags:

r

ggplot2

I'm trying to plot a world map using ggplot2. Here is what I have so far:

library(ggplot2)
world <- map_data("world")
ggplot(aes(long, lat, group=group), data=world) + geom_polygon()

This works well and is easy to do. Unfortunately, the world map data seems old. For example, countries like Singapore and Czech Republic are missing and instead there are regions like USSR. Any idea how I can get more up to date world map data?

sort( unique(world$region) )
  [1] "Afghanistan"              "Albania"                  "Algeria"                 
  [4] "American Samoa"           "Andaman Islands"          "Andorra"                 
  [7] "Angola"                   "Anguilla"                 "Antarctica"              
 [10] "Antigua"                  "Aral Sea"                 "Argentina"               
 [13] "Aruba"                    "Australia"                "Austria"                 
 [16] "Azores"                   "Bahamas"                  "Bahrain"                 
 [19] "Bangladesh"               "Barbados"                 "Barbuda"                 
 [22] "Belgium"                  "Belize"                   "Benin"                   
 [25] "Bhutan"                   "Black Sea"                "Bolivia"                 
 [28] "Bonaire"                  "Botswana"                 "Brazil"                  
 [31] "Brunei"                   "Bulgaria"                 "Burkina Faso"            
 [34] "Burundi"                  "California"               "Cambodia"                
 [37] "Cameroon"                 "Canada"                   "Canary Islands"          
 [40] "Cape Verde"               "Caspian Sea"              "Cayman Islands"          
 [43] "Central African Republic" "Chad"                     "Chagos Archipelago"      
 [46] "Chile"                    "China"                    "Colombia"                
 [49] "Comoros"                  "Congo"                    "Cook Islands"            
 [52] "Costa Rica"               "Cuba"                     "Curacao"                 
 [55] "Cyprus"                   "Czechoslovakia"           "Denmark"                 
 [58] "Djibouti"                 "Dominica"                 "Dominican Republic"      
 [61] "Ecuador"                  "Egypt"                    "El Salvador"             
 [64] "Equatorial Guinea"        "Ethiopia"                 "Falkland Islands"        
 [67] "Fiji"                     "Finland"                  "France"                  
 [70] "French Guiana"            "French Polynesia"         "Gabon"                   
 [73] "Gambia"                   "Gaza Strip"               "Germany"                 
 [76] "Ghana"                    "Great Bitter Lake"        "Great Lakes"             
 [79] "Greece"                   "Greenland"                "Grenada"                 
 [82] "Guadeloupe"               "Guatemala"                "Guinea"                  
 [85] "Guinea-Bissau"            "Guyana"                   "Haiti"                   
 [88] "Hawaii"                   "Honduras"                 "Hungary"                 
 [91] "Iceland"                  "India"                    "Indonesia"               
 [94] "Iran"                     "Iraq"                     "Ireland"                 
 [97] "Irian Jaya"               "Isle of Man"              "Isle of Wight"           
[100] "Israel"                   "Italy"                    "Ivory Coast"             
[103] "Jamaica"                  "Japan"                    "Jordan"                  
[106] "Kenya"                    "Kiribati"                 "Kuwait"                  
[109] "Lacul Greaca"             "Lake Albert"              "Lake Fjerritslev"        
[112] "Lake Kariba"              "Lake Malawi"              "Lake Pasvikelv"          
[115] "Lake Tanganyika"          "Lake Titicaca"            "Lake Victoria"           
[118] "Laos"                     "Lebanon"                  "Lesotho"                 
[121] "Liberia"                  "Libya"                    "Liechtenstein"           
[124] "Luxembourg"               "Madagascar"               "Madeira Islands"         
[127] "Malawi"                   "Malaysia"                 "Maldives"                
[130] "Mali"                     "Malta"                    "Marshall Islands"        
[133] "Martinique"               "Maug Island"              "Mauritania"              
[136] "Mauritius"                "Mexico"                   "Micronesia"              
[139] "Monaco"                   "Mongolia"                 "Montserrat"              
[142] "Morocco"                  "Mozambique"               "Myanmar"                 
[145] "Namibia"                  "Nauru"                    "Nepal"                   
[148] "Netherlands"              "Neutral Zone"             "Nevis"                   
[151] "New Caledonia"            "New Zealand"              "Nicaragua"               
[154] "Niger"                    "Nigeria"                  "North Korea"             
[157] "Northern Mariana Islands" "Norway"                   "Oman"                    
[160] "Pakistan"                 "Panama"                   "Papua New Guinea"        
[163] "Paracel Islands"          "Paraguay"                 "Peru"                    
[166] "Philippines"              "Pitcairn Islands"         "Poland"                  
[169] "Portugal"                 "Puerto Rico"              "Qatar"                   
[172] "Romania"                  "Rwanda"                   "Saint Eustatius"         
[175] "Saint Kitts"              "Saint Lucia"              "Saint Vincent"           
[178] "Saint-Barthelemy"         "Saint-Martin"             "Samoa"                   
[181] "San Marino"               "Sao Tome and Principe"    "Sardinia"                
[184] "Saudi Arabia"             "Senegal"                  "Seychelles"              
[187] "Sicily"                   "Sierra Leone"             "Sin Cowe Island"         
[190] "Solomon Islands"          "Somalia"                  "Sonsorol Island"         
[193] "South Africa"             "South Korea"              "South Sandwich Islands"  
[196] "Spain"                    "Spratly Island"           "Sri Lanka"               
[199] "Sudan"                    "Suriname"                 "Swaziland"               
[202] "Sweden"                   "Switzerland"              "Syria"                   
[205] "Tanzania"                 "Thailand"                 "Tobago"                  
[208] "Togo"                     "Tokelau"                  "Tonga"                   
[211] "Trinidad"                 "Tunisia"                  "Turkey"                  
[214] "Turks and Caicos"         "Tuvalu"                   "Uganda"                  
[217] "UK"                       "United Arab Emirates"     "Uruguay"                 
[220] "USA"                      "USSR"                     "Vanuatu"                 
[223] "Venezuela"                "Vietnam"                  "Virgin Islands"          
[226] "Vislinskiy Zaliv"         "Wales"                    "West Bank"               
[229] "Western Sahara"           "Yemen"                    "Yugoslavia"              
[232] "Zaire"                    "Zambia"                   "Zimbabwe"   
like image 825
Chris Avatar asked Jan 21 '13 19:01

Chris


2 Answers

Have you compared it to the database in mapdata?

If that's not better, you can use the Global Administration Database, or NOAA's GSHHG database.

If you need help dealing with shapefiles, there's a fantastic example from Spatial Analysis (here) that uses ggplot2.

like image 63
Andy Barbour Avatar answered Oct 19 '22 06:10

Andy Barbour


The 'world' database in 'maps' has recently (2015) been updated, using data from Natural Earth. As of version 3.0, the map is up to date.

like image 2
Alex Deckmyn Avatar answered Oct 19 '22 07:10

Alex Deckmyn