Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save johandahlberg/9289646 to your computer and use it in GitHub Desktop.
Save johandahlberg/9289646 to your computer and use it in GitHub Desktop.
Just a little visualization of the participants for KP2014.
library(ggplot2)
library(reshape2)
library(maps)
# A tab separated file with contries and participats.
# Note that Unites States needs to be changed to USA and United Kingdom
# to UK.
path.to.contry.and.participants.file <- "~/Desktop/contries.csv"
participants <-
read.csv(file= path.to.contry.and.participants.file, sep="\t",header=FALSE, col.names=c("Contry","Participants"))
world.map <-
map_data("world")
map.and.participants <-
merge(x=world.map, y=participants, by.x="region", by.y="Contry", all.x = TRUE)
map.and.participants <-
map.and.participants[with(map.and.participants, order(order)), ]
p <- ggplot()
p <- p + geom_polygon(data=map.and.participants,
aes(x=long, y=lat, group = group, fill=Participants),
colour="white")
p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment