Updated map in R maps package

The maps package in R plots very nice maps at global to regional scales. The problem with maps was that it used a 1990 map of national borders: slightly awkward when plotting maps covering countries that were once part of, for example, the Soviet Union and are proud of their independence.

I used to circumvent this problem by plotting the country borders the same colour as their fill with

library(maps)
map(col = "grey80", border = "grey80", fill = TRUE)
map(col = "grey80", border = "grey80", fill = TRUE,
xlim = c(10, 30), ylim = c(46,53)) #FAIL

This works at the global scale, but fails miserably if you want to plot a swathe of Eastern Europe.

Today, I am in Estonia giving a tutorial on R to some palaeolimnologists, and was rather embarrassed to have to explain that their country didn’t exist according to R’s easy to use mapping package. I told them that it was possible to use shapefiles as an alternative, but that is somewhat more involved.

Wondering if there was an alternative way to plot Estonia and other recently independent countries (or how much work it would be to update the map), I was delighted when I downloaded the maps package from CRAN and got the message

# ATTENTION: maps v3.0 has an updated ‘world’ map. #
# Many country borders and names have changed since 1990. #
# Type ‘?world’ or ‘news(package=”maps”)’. See README_v3. #

when I loaded the package.

The maps package now uses CIA’s current political borders database (Crimea is Ukrainian). Many thanks to whoever updated the package.

library(maps)
map(col = "grey80", border = "grey40", fill = TRUE,
  xlim = c(10, 36), ylim = c(36, 62), mar = rep(0.1, 4))
box()
Rplot001

Eastern Europe with political borders

Advertisements

About richard telford

Ecologist with interests in quantitative methods and palaeoenvironments
This entry was posted in R, Uncategorized and tagged . Bookmark the permalink.