I don't really like this plot, but I am curious how to create it anyway


Hey folks!

As I’m writing this newsletter the US government is in shutdown mode with no clear signs that things will get going anytime soon. I’ll withhold my own political take except to say that my family has been running without an official budget for about 25 years. I don’t recommend it, but we know basically how much money goes to our mortgage, insurance, groceries, charities, etc. and how much money we generally have left over. Somehow we still are able to spend money on living a pretty comfortable life and, of course, we still pay the bills… including our taxes. There’s one party that controls the Legislative and Executive branches. Even if we don’t like the funding scheme they come up with, you’d think they could figure out to how to show some leadership and pass something. Anyway, this isn’t a politics newsletter. It’s a data visualization newsletter. The Washington Post gave a try at trying to show who Americans blame…

What does it say to me? With one exception, in 2023, we typically blame Republicans for government shutdowns. It also seems like we have had more shutdowns over the past 12 years than we have before then. Perhaps this is because we haven’t had a proper budget since about 2008. Instead, we’ve had continuing spending resolutions. These seem to be an exercise in brinkmanship. What don’t you like about this plot? I think there’s more I don’t like about this plot than that I do like. If you add up the totals for each shutdown you’ll see that they don’t come close to adding up to 100%. This is because many people think that both parties are to blame. A second element of this plot that I don’t like is that it is hard to compare within a year the fraction that blamed Democrats vs. Republicans. I would have preferred to use a dot plot where I’d still leave the date on the y-axis, the percent blame would be on the x-axis, and the party being blamed would get a different colored plotting symbol - maybe red, blue, and purple. What do you like? I’m not sure… :) I picked this because I’m mostly curious how I’d make it in R… How would I make this in R? Good question! Several things stand out to me.

It’s a diverging bar plot, with a catch. The catch is that there’s a gap between the base of the two bars. Because of that gap, I’d likely make this as a faceted plot. There’s another catch. The segment of each larger rectangle that doesn’t go towards the party getting blamed is shaded in. I’d treat that as a stacked bar plot. Got it? We’ve got a faceted, stacked bar plot.

Let’s think about the data. We’ll have a column for the facet that would have two values - “democrats” and “republicans”. There will also be a column for who’s to blame - “democrats”, “republicans”, and “unaccounted”. The value for “democrats” in the “republicans” facet will be zero. The value for “republicans” in the “republicans” facet will be what’s in the white text. The value for “unaccounted” in the “republicans” facet will be the difference between 53 and the value in the white text. So for the “Oct. 2025” shutdown “unaccounted” would be 6. I’m pretty certain that the “democrats” facet is the same width as the “republicans” facet. So, its total will be 53 as well. We’ll need to play some with treating these variables as factors and getting the ordering correct of the facets, the rows, and stacked rectangles.

In addition to using geom_col() to create the stacked bar plot we’ll need to use geom_text() to insert the numbers. I think that I’d use the nudge_x argument in geom_text() to nudge the label left or right. In the “unaccounted” rectangle I’d set the label to "" so nothing gets inserted. In the new version of {ggplot2} we can insert nudge_x into the aes() function so we can add the nudge amount into our tibble.

Now let’s return to the facets. They have titles. We can likely format the titles using the strip.text argument in theme(). One thing that makes me pause is whether we can right justify one facet label and left justify the other. I just did something like that for x-axis text in this week’s livestream, so I’m optimistic we can do it here. Alternatively, maybe we can use HTML/CSS styling to set the justification.

Again, there’s a lot more I don’t like about this plot than what I do like about it. I was mostly interested in how to make it. What do you think? I’d love to get your insights. Stay tuned for next Wednesday (10/22/2025) when I’ll try to recreate this visualization on a YouTube livestream!

Workshops

I'm pleased to be able to offer you one of three recent workshops! With each you'll get access to 18 hours of video content, my code, and other materials. Click the buttons below to learn more

In case you missed it…

Here is a livestream that I published this week that relate to previous content from these newsletters. Enjoy!

video preview

Finally, if you would like to support the Riffomonas project financially, please consider becoming a patron through Patreon! There are multiple tiers and fun gifts for each. By no means do I expect people to become patrons, but if you need to be asked, there you go :)

I’ll talk to you more next week!

Pat

Riffomonas Professional Development

Read more from Riffomonas Professional Development

Hey folks! I’m appreciating the positive feedback on Monday critique videos. They’re a lot of fun to think through and make. I think I might start looking at figures that are drawn from the scientific literature since many of you found out about me from my science work. Let me know if there are plots or practices that you’d like to see me talk about. I’ll see if I can work them into the queue. Also, if you’re working on developing figures for a presentation, poster, or paper and would like to...

Hey folks! I continue to get positive feedback about my critique videos. This has me quite excited that I’ve perhaps scratched an itch that people have been struggling with. Would you like to meet with a group of other people who are committed to making their data visualizations better? I’m forming groups now that would meet once a week or every other week to give each other constructive feedback on the visualizations they are making for their work. Alternatively, if you have ever thought, “I...

Hey folks! I posted two videos last week! On Monday I posted a video critiquing the diverging bar plot that I described in this newsletter last Friday. My goal in this video was to think through a “constructive” approach to interpreting and critiquing data visualizations. As scientists, I think we are too worried about hurting each other’s feelings. So we don’t critique each other. At the same time, many of us think before we speak and can come off overly harsh. My goal is to create a...