Search notes:

R package: maps

maps contains outlines of continents, countries, states and counties.

World without borders

library(maps)

png('img/borderless-world.png', width=400, height=200)
map('world', col="#ccdee1", fill=TRUE,  mar=rep(0,4), lwd=0.01)
Github repository about-r, path: /packages/maps/borderless-world.R

World with borders

library(maps)

png('img/world-with-borders.png', width=400, height=200)
map('world', col="#ccdee1", fill=TRUE,  mar=rep(0,4), border='#2244ff', lwd=0.5)
Github repository about-r, path: /packages/maps/world-with-borders.R

Plotting coordinates

library(maps)

coordinates <- data.frame (
  lon = c(-118, -28,  30, 68, 82, -13),
  lat = c(   5, - 8, -45,  0, 42,  78)
)

png('img/coordinates.png', width=600, height=300)
map('world', col="#ccdee1", fill=TRUE,  mar=rep(0,4), lwd=0.01)
points(
   x  = coordinates$lon,
   y  = coordinates$lat,
   col='#ff7722',
   cex= 1.2,
   pch= 16
)
text(
   paste(coordinates$lon, ' /', coordinates$lat),
   x   = coordinates$lon,
   y   = coordinates$lat,
   pos = 4,
   cex = 1.2
)
Github repository about-r, path: /packages/maps/coordinates.R

See also

The rworldmap package.
R package: ggswissmaps
R packages
Data visualization: map

Index