MENU

Fun & Interesting

Recreating a New York Times bar chart using the ggplot2 R package (CC332)

Riffomonas Project 1,083 3 months ago
Video Not Working? Fix It Now

Pat recreates a visualization from the New York Times showing the increase in flooding declarations as a bar chart using the ggplot2, ggtext, and showtext R packages. This barplot is distinctive because it highlights one column with a different color. To recreate off this visualization, Pat uses geom_col, geom_richtext, scale_fill_manual, coord_cartesian, labs, theme_classic, and theme. You can find the data and code he developed in this episode at https://www.riffomonas.org/code_club/2025-01-13-flooding-nyt. The original NYT article can be found at https://www.nytimes.com/2024/10/22/briefing/americas-flooding-problem.html. Pat's newsletter describing how he would go about generating the figure can be found at https://shop.riffomonas.org/posts/flooding-you-opportunity-to-practice-your-data-viz-skills-in-r. If you have a figure that you would like to see me discuss in a future newsletter and episode of Code Club, email me at [email protected]! 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 purchasing a video workshop be sure to check out https://riffomonas.org/workshops/ Support Riffomonas by becoming a Patreon member! https://www.patreon.com/riffomonas 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/ If you want to cite this video, please consider citing https://journals.asm.org/doi/10.1128/mra.01310-22 0:00 Introduction 2:24 Creating colored bar plot 10:42 Creating annotation bubble 17:10 Formatting x and y axes 26:59 Incorporating fonts from Google fonts

Comment