Last active
July 6, 2021 01:27
-
-
Save MrFlick/8114a37fcfe6e093570248dad56a5865 to your computer and use it in GitHub Desktop.
Plotting the world (gapminder data)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(gapminder) | |
library(dplyr) | |
library(ggplot2) | |
library(ggthemes) | |
mapdata <- map_data("world") %>% | |
mutate(region = recode(region, | |
USA="United States", | |
UK="United Kingdom")) | |
gapminder %>% | |
filter(year==2007) %>% | |
ggplot() + | |
geom_map(aes(map_id=country, fill=lifeExp), map=mapdata) + | |
expand_limits(x = mapdata$long, y = mapdata$lat) + | |
coord_map(projection = "mollweide", xlim = c(-180, 180)) + | |
ggthemes::theme_map() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment