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! Before launching into this week’s visualization, I’m looking for a bit of feedback. Since November, I’ve settled into a new routine with this newsletter and the YouTube channel. Each week this newsletter introduces a visualization at a 30,000 ft view or discusses a specific topic in some depth (example). The following Monday I post a video critiquing the visualization (example). Then on Wednesday (or Tuesday like this past week), I livestream a video where I recreate the...

Hey folks! I just got back from a seminar. I’m still trying to stretch out my eyes from straining to see the small text on each slide! If you don’t know why I’m brining this up, then you must have missed the videos I posted earlier this week. I was discussing the factors we should consider when converting figures designed for papers to figures designed to a slide deck. You can see me critique a figure from my own lab here and the livestream where I refactor the figure can be found here. I’d...

Hey folks, I was a student-invited speaker at the Syracuse University Biology department this week. It was great to meet with them and hear how they are benefiting from these newsletters and my videos. As much as I love posting newsletters and videos, seeing people light up at ideas, laugh at my jokes, and tell me how they are using what I teach them is like jet fuel. I actually gave two talks. One talk covered what I’ve learned about data visualization by critiquing, recreating, and remaking...