Map Showing #DataTrieste Attendee Distribution

This post was written by Shiva KhanalResearch Officer with the Department of Forest Research and Survey in Nepal.  Shiva was one of the international scholars sponsored by GEO, the Group on Earth Observations to attend the CODATA-RDA School of Research Data Science, hosted at ICTP, near Trieste, Italy.

The CODATA-RDA Research Data Science Summer School was held at the ICTP, Trieste, Italy
from 1st to 12th August 2016. I was one of the candidates who received funding from GEO, the Group on Earth Observations to attend this interesting event.

Looking at the big list of participants from around the world, as a “Map Enthusiastic Person” the first thing I was interested in was to visualize their distribution. Interestingly, in the summer school there was a presentation by Andy South (@southmapr) and he included a demonstration of making world maps in R using the tmap package.page_banner_l

I obtained list of participants with their countries in a spreadsheet from Simon Hodson. Took out the countries field and made a map using tmap package in R to show the distribution of participants and instructors in this summer school.

Countries_Represented

###########################################
# The R code to reproduce the map follows:
###########################################
#read a vector of countries represented – 35 in total
# I have saved the list of countries as a csv in my Dropbox and the code below will read it.
# Just found a better option for later use: a Dropbox interface for R (https://github.com/karthik/rdrop2)
download.file(“https://www.dropbox.com/s/56jim5t3gz67vzm/countries_represented_codata.csv?dl=1”, “countries_list.csv”)
codata_countries <- read.csv(“countries_list.csv”)$country
#install and load tmap package
if (!require(“tmap”)) install.packages(“tmap”)
#now lets map the countries
data(World)
codata_map <- tm_shape(World) +
tm_borders() +
tm_fill(“grey90″, aplha= 0.2)+
tm_grid(projection=”longlat”, labels.size = .3, lwd=0.5, col=”lightblue”) +
tm_shape(World[ World@data$name %in%  codata_countries , ]) + tm_fill(“red”)+
tm_text(“name”, size=”AREA”, col = “black”)+ #countries label proportional to area, so
smaller/no_label for smaller ones!
tm_borders(“grey20”) +
tm_layout(“Countries represented in CODATA-RDA School of Research Data Science, 2016”,
inner.margins=c(0,0,.1,0), title.size=.9, title.position = c(“center”, “top”))+
tm_style_natural(bg.color = “lightskyblue”)
codata_map
#save the output map
save_tmap(codata_map, “Countries_Represented.png”, width=2000, height=1200)
###########################################

The nice vignette for tmap package is here: https://cran.r-project.org/web/packages/tmap/vignettes/tmap-nutshell.html
Martijn Tennekes (2016). tmap: Thematic Maps. R package version 1.4-1. https://CRAN.R-project.org/package=tmap

One thought on “Map Showing #DataTrieste Attendee Distribution

Leave a Reply

Your email address will not be published. Required fields are marked *