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! This week I have a figure for you from the New York Times based on a poll they did with Siena that describes Americans’ sentiments concerning Israel’s actions in their war with Gaza. What does it say to me? This plot is saying that more Americans think that Israel is intentionally killing civilians than they did in December 2023. The change in percentage of people in the other categories seems to decrease accordingly. What do you like? I love slope plots! I think they’re a great...

Hey folks, This week I have an interesting figure for you from the Financial Times from an e-mail newsletter they distribute each week describing some visualization related to climate change. Before reading further, go ahead and spend a few minutes with the image. What does it say to you? What do you like? What don’t you like about it? How do you think you would go about making it in R? I’d encourage you to write down any of your answers to these questions before reading what I have to say....

Hey folks! I’m in proposal writing mode again. Unfortunately, I am finding my weekly search for a data visualization to share with you is leading me down unproductive internet rabbit holes. So, I thought I’d share an idea with you that I hope resonates. If you have any reactions, please send them my way! For the past year or so I have been recreating other people’s data visualizations in an attempt to learn new techniques with R and expand the type of data that I normally visualize. The idea...