Visualizing Geospatial Data in R
Charlotte Wickham
Assistant Professor at Oregon State University
ggplot2
:ggplot2
expects data in data frames, tmap
expects data in spatial objectslibrary(tmap) data(Europe)
tm_shape(Europe) +
tm_borders()
library(tmap) data(Europe)
tm_shape(Europe) +
tm_borders() + tm_fill(col = "part")
tm_fill()
tm_borders()
tm_polygons()
tm_bubbles()
tm_dots()
tm_lines()
tm_raster()
tm_text()
library(tmap) data(Europe)
tm_shape(Europe) +
tm_borders() + tm_fill(col = "part") + tm_compass() + tmap_style("cobalt")
scale_
equivalents, tweaks to scales happen in relevant layer calltm_shape()
defines default data for any subsequent layers, you can have many in a single plotx
and y
aesthetics, these are inherent in spatial objectsVisualizing Geospatial Data in R