Creating a heatmap map with geom_tile from ggplot2 in R (CC258)

October 20, 2022 • PD Schloss • 1 min read

Pat shares how to create a world-wide map of precipitation data as a heatmap using ggplot2’s geom_tile function in R. To generate the final figure he is plotting the z-score of monthly precipitation for each longitude and latitude relative to the precipitation over the past 30 days for each long and lat combination. The overall goal of this project is to highlight reproducible research practices using a number of tools including ggplot, geom_raster, geom_tile, scale_fill_gradient2, labs, theme, and more. The specific output from this project will be a map-based visual that shows the level of drought across the globe.

Code

You can browse the state of the repository at the