MENU

Fun & Interesting

Programming a line plot in R to show climate change with and without animation (CC225)

Riffomonas Project 3,178 lượt xem 2 years ago
Video Not Working? Fix It Now

Pat shares how he would use r programming to recreate a line plot displaying climate change by month and year using ggplot2. The data depicted are monthly temperature anomalies by month using NASA's GISS data using tools from the ggplot2 R package. This figure shows the deviation in annual global mean temperatures from the normalized temperatures of 1980 to 2015 as a series of lines created using ggplot2's geom_line function. The lines are colored according to the average temperature anomaly for the year. Finally, he'll show how he would animate the figure with tools from gganimate. All of this is done in R with the help of RStudio.

You can find my blog post for this episode at https://www.riffomonas.org/code_club/2022-06-27-monthly-anomaly.

#ggplot2 #geom_line #gganimate #Rstudio #climatechange #R #Rstats

Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at https://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 https://riffomonas.org/workshops/

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

0:00 Introduction
2:44 Creating monthly adjustments data frame
5:55 Creating raw version of figure
10:18 Applying color gradient to lines
14:14 Adjusting the theming of the figure
19:33 Creating final figure from GIF
22:28 Creating GIF version of figure

Comment