Skip to content

Instantly share code, notes, and snippets.

@cavedave
Last active August 25, 2016 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cavedave/9f2b3b36f71e53b0aad7ccfd9e26a2a0 to your computer and use it in GitHub Desktop.
Save cavedave/9f2b3b36f71e53b0aad7ccfd9e26a2a0 to your computer and use it in GitHub Desktop.
Image created is at http://imgur.com/gallery/wiwpz
install.packages("choroplethr")
install.packages("choroplethrMaps")
library(choroplethr);
library(choroplethrMaps)
library(ggplot2)
data(country.map)
data(country.regions)
a<-c(29,25,4,4,7,11,11,8,7,4,6,9,3,8,6,3,17,3,8,4,12,18,10,10,7,7,5,3,10,23,31,17,6,9,5,4,5,8,16,24,9)
target<-c("albania","armenia","austria","belarus","belgium","bosnia and herzegovina","bulgaria","croatia","cyprus","czech republic",
"denmark","estonia","finland","france","germany","greece","hungary","iceland","ireland","italy","kazakhstan","latvia","lithuania","luxembourg","montenegro","netherlands","norway","poland","portugal","moldova","romania","republic of serbia","slovakia","slovenia","spain","sweden","switzerland","macedonia","turkey","ukraine","united kingdom")
datas<-data.frame(region=target,value=a)
datas$region<-as.character(datas$region)
gg <- country_choropleth(datas,legend="",num_colors=1,zoom=target)
gg <- gg + xlim(-31.266001, 39.869301)
gg <- gg + ylim(27.636311, 81.008797)
gg <- gg + coord_map("lambert", lat0=27.636311, lat1=81.008797)
gg
gg2 <- gg + ggtitle("\nW.H.O. Maternal mortality\n per 100,000 live births") +
theme(plot.title = element_text(family = 'Helvetica',
color = '#666666',
face = 'bold',
size = 25))
gg2 <- gg2 + annotate("text", x = -30, y = 50, label = "
Finland 3
Greece 3
Iceland 3
Poland 3
Austria 4
Belarus 4
Czech Republic 4
Italy 4
Sweden 4
Norway 5
Spain 5
Switzerland 5
Denmark 6
Germany 6
Slovakia 6
Belgium 7
Cyprus 7
Montenegro 7
Netherlands 7
Ireland 8")
gg2 <- gg2 + annotate("text", x = 33, y = 33, label = "Source: http://apps.who.int/gho/data/node.main.MATMORT")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment