Hey folks, I really enjoyed teaching a one-day, introduction to ggplot2 workshop last week. It was a lot of fun - I enjoyed teaching the principles behind ggplot2. I’ve been noticing many learners (and teachers) focusing on making templates that they can recycle to make variations on a common plot type. This is how I often teach ggplot2 and the rest of the tidyverse - it’s also how I learned R. In the most recent workshop I was testing a hypothesis that teaching concepts would yield more long term learning gains than the template approach. I’d love to work out some of the kinks and teach it again. Let me know if you’d be interested in learning by this alternative approach. If you’re a late-Gen Xer like me, the word “waterfall” will instantly queue up in your mind the song “Waterfalls” by TLC. Whenever I see a waterfall chart, I think of this song. Sorry. Not sorry :) Anyway, last week I found this waterfall chart in a Washington Post article on the 0.3% drop in the US GDP during the first quarter of 2025. Waterfall charts are helpful for depicting the cumulative effect of positive and negative components. For the GDP, personal consumption, private investment, government spending, and exports typically count in the positive direction and imports in the negative direction. For the first quarter, government spending was down a smidge, leading to a similar decrease in GDP. I was able to gather these data from the data linked through the Bureau of Economic Analysis.
I thought this would be a great plot to share with you all. I instantly started thinking about how I would create this in R. This plot has a few cool things going on. First, there are vertical line segments with arrows. I would create these using Second, there are the bars. Normally when I see these rectangles I think, “bar plot!”. But bar plots start at 0 on the y-axis. These bars start at different locations for each category similar to the arrows. Instead, I’d either use Third, each rectangle has a solid black line at either end to indicate the top and bottom edge. I’d likely do this with Let’s pause here for a moment… Could I generate this waterfall chart using only Next, there’s annotation for each piece of the waterfall where the category label is bolded and colored like the bar. The rest of the text is in a regular black font. The labels vary in how the text is justified. Because of the combination of font faces and colors, I’d likely use Finally, there are also the grid lines. At first appearances they look normal. But, the grid line that intercepts the y-axis at +1 is on top of the “Personal consumption” segment and behind the “Imports” segment. All the other grid lines are behind their segments… why?! I think this is silly. If I wanted to follow this faithfully, I’d likely use the background grid lines that are controlled with the Let me know what you think of this type of plot. Have you seen waterfall charts in your work? I’d love to see more examples.
|
Hey folks, If you’re interested in participating in a 1-day (6 hours) data visualization workshop, you’re running out of time to register. I’ll be teaching this workshop on May 9th. I will cover an introduction to the ggplot2 package and will assume no prior R knowledge. My goal is to help you to understand the ggplot2 framework and begin to apply it to make some interesting and compelling visualizations. After this workshop, you should be able to learn more advanced topics on your own. You...
Hey folks, I’m gearing up to teach a 1-day (6 hours) data visualization workshop on May 9th. This workshop will cover an introduction to the ggplot2 package and will assume no prior R knowledge. My goal is to help you to understand the ggplot2 framework and begin to apply it to make some interesting and compelling visualizations. From this workshop, I hope that you would be able to go off on your own journey learning more advanced topics. You can learn more and register by clicking the button...
Hey folks, Long time friends of Riffomonas know that I’ve been teaching data science classes for close to 20 years. The hallmark of my teaching has been three-day workshops where I either teach R (here and here) or the mothur software package. I’ve gotten feedback that three days is just too much time for people to carve out of their busy schedules. So, I’m excited to be offering a 1-day (6 hours) data visualization workshop on May 9th. This will cover an introduction to the ggplot2 package....