Visualization Challenge: Mapping Health During Travel
1. Epidemiology, Biostatistics and Prevention Institute
31/3/2016
Visualization Challenge:
Mapping Health During Travel
R Visualization Special
3 August 2016
Andrea Farnham, MPH
University of Zürich
andrea.farnham@ifspm.uzh.ch
2. Epidemiology, Biostatistics and Prevention Institute
How can we detect patterns in
health behaviors, health
outcomes, and environmental
cues in travelers using a
combination of streaming data
and traditional questionnaires?
4. Epidemiology, Biostatistics and Prevention Institute
R Code
library("ggmap")
travel_data <- data.frame(lon =
heidifigure_locationpoints$longitude, lat =
heidifigure_locationpoints$latitude,
label=heidifigure_locationpoints$event,
day=heidifigure_locationpoints$day)
thailand <- get_map(location = c(96.2, 3.7,
107.5, 22.1), source="stamen", maptype="toner")
ggmap(thailand) + geom_point(data = travel_data,
aes(x = lon, y = lat), shape=1, color="red",
size=1.4, alpha=.5)
+ geom_label_repel(data = travel_data, aes(x =
lon, y = lat, label = label), size = 3)
Create data frame of
latitude and longitude
points
Call up map of Thailand
Map points on map of
Thailand
Add data labels
5. Epidemiology, Biostatistics and Prevention Institute
2 Step Process
• Download and format map image using get_map
• Plot additional layer(s) of data or statistics with ggmap
Source: https://www.r-bloggers.com/google-maps-and-ggmap/
maptype = "satellite" maptype = “roadmap"maptype = “terrain"
6. Epidemiology, Biostatistics and Prevention Institute
Thank you!
Contact information
Andrea Farnham, MPH
Epidemiology, Biostatistics and Prevention Institute (EBPI)
University of Zurich
Hirschengraben 84
CH-8001 Zurich
Phone +41 44 634 54 37
andreacarol.farnham@uzh.ch
www.ebpi.uzh.ch