Creating a raster map of global climate change in R with ggplot2's geom_raster (CC227)

Published 2022-07-05
Pat uses R to create a faceted raster map displaying the annual global temperature anomalies between 1950 and 2021 using functions from ggplot2. Beyond introducing the geom_raster function, Pat will also compare facet_wrap and facet_grid and demonstrate how to format the appearance of the facet labels. The result is a very cool visualization of the change in temperature across the world for the past 70+ years. He also makes use of tools from the dplyr, ggplot2, and other packages from the tidyverse. The data depicted are the average annual temperature anomalies by latitude and longitude using NASA's GISS data. All of this is done in R with the help of RStudio.

You can find my blog post for this episode at www.riffomonas.org/code_club/2022-07-05-anomaly-ma….

#geom_raster #facet_grid #facet_wrap #ggplot2 #Rstudio #climatechange #R #Rstats

Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at shop.riffomonas.org/youtube to get practice problems, tips, and insights.

If you're interested in taking an upcoming 3 day R workshop be sure to check out our schedule at riffomonas.org/workshops/

You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: www.riffomonas.org/minimalR/
General data: www.riffomonas.org/generalR/

0:00 Introduction
2:45 Creating global map of temperature anomalies for one year
6:08 Stylizing appearance of single panel
9:48 Create faceted version of figure for all years
14:38 Stylizing appearance of facets
16:30 Improve appearance of colors
19:02 Change legend location and format appearance
22:19 Finishing touches

All Comments (7)
  • @NATS7599
    Once again, fantastic instruction! Appreciate your dedication in making this content universally available. I am a fan of code club!
  • I love your videos. I have learned a lot from you!!! Thanks for sharing the knowledge
  • @yaqinguo8971
    Amazing. So much information!!! floor, case_when function, especially facet_wrap and facet_grid. Before i don't really know the difference.
  • @DYT32
    Muito bom, aprendi muito. Obrigado
  • Hi, Thanks for the video. Very useful to me since I'm new to R. I have a question though: how to convert to Robinson projection? Thanks
  • Hi.Sorry,i have a question. I need to upload all the files (.txt) at once, and from each file to another file (.csv) pull out a specific column. I will be glad if you help me.