Create a simple world map with the borders of countries with R

22 November 2022



library(ggmap)
library(data.table)
library(ggplot2)

world <- data.table(map_data("world"))

ggplot(world)+
  geom_map(map = world, aes(long, lat, map_id = region), color = "white", fill = "lightgray", size = 0.1)

Picture

ggplot(world[region %like% "France|Spain|Portuga"])+
  geom_map(map = world, aes(long, lat, map_id = region), color = "white", fill = "lightgray", size = 0.1)

Picture






Comments

    Join the discussion for this article on this ticket. Comments appear on this page instantly.
    Thanks to aristaht for making this static comment system possible.