Have I mentioned that I love slope plots? Here's one from the NYT


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 strategy for showing the change in a variable between two time points. As always, I am a fan of the NY Times minimalist aesthetic to plots. What don’t you like? Although the war has been in the news for several years now, I’m not sure that Americans - in general - have a very good sense of what’s going on or how Israel is waging the war. This somewhat comes through in the percentage that don’t have an opinion. For December 2023 the three categories only add to 72% and for September 2025 they add to 81%. I feel like that’s a big pool of people with no opinion. How would I make this in R? Good question! Several things stand out to me.

First, the slope plot itself. There are lines and points at the end of the lines. I imagine having a data frame with three columns - date, sentiment, and percentage. I’d map the date to the x-axis and the percentage to the y-axis. Then I’d group and color the lines by the sentiment. We can draw the lines with geom_line() and add the points with geom_point(). For the x-axis, I don’t think I’d make the date an actual date variable type. The date type has some nice features when there are many dates, but it does add some cognitive overhead. Here, I think I’d use the date as a categorical variable since there are only two dates.

Second, the points and lines are labelled. The plot includes the percentage of respondents with each of the three sentiments at each date. The text label uses a bold font for “Intentionally” and “Unintentionally” and a regular font for the third category. I actually forget if I can vectorize the fontface argument to geom_text(). If I can’t, I’d likely use geom_richtext(). I’d probably prefer geom_text() since I can use it with annotate() and I can’t use geom_richtext() with annotate(). Using annotate() would be a simple way to add the three sentiments to the plot. Regardless of the geom I end up using, I notice that those labels are off in the right margin of the plot. To achieve this and have the y-axis only cover the two categories, I’d use clip = "off" and expand = FALSE as arguments in coord_cartesian(). Also, I’d likely use geom_text() to add the percentages to the points with some customized y-axis positions to get their placement correct. The 2023 values are left justified and the 2025 values are right justified.

Third, I already mentioned the x-axis line. I’ll need to figure out how to get the x-axis text to not be centered under the tick. Again, I’m not sure if I can vectorize the hjust parameter to element_text() but that would be the first thing I’d try. Alternatively, I’d leave the ticks and remove the text using the theme() function but add the text to the correct position again using annotate(). Of course, they’ve also removed the y-axis line, text, and ticks and neither axis has a title.

Finally, they have some fun stuff going on with their titles and captions! I count three bits of text above the plot. Within labs(), I’d likely use tag = for the name of the poll, title = for the line with the dates, and subtitle = for the question. That looks like it will involve some fun formatting. At the bottom is the first time I’ve seen a right justified caption. That’s the default {ggplot2} setting, but I always seem to make it left justified. It’s great to see one of these out in the wild :)

What do you think about this plot? I’d love to get your insights. It’s likely you have an idea that is better than mine or at least having a try at. Stay tuned for a future YouTube video when I try to implement this figure.

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 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...

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...

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....