Lions and tiger and bears and SPIRALS, oh my!?


Hey folks,

I hope you have enjoyed the current series of newsletters and videos recreating “data portraits” from the WEB DuBois collection of visuals he showed at the 1900 Paris Exhibition. You can find the entire collection of “data portraits” in a book assembled by Whitney Battle-Baptiste and Britt Rusert (here) or as a collection of plates through the Library of Congress (here). I’ve really appreciated the positive feedback! These figures are pretty different from what we do in modern data visualizations. But, I have found tremendous value in recreating them. Of course, I am strengthening my R skills in terms of getting more dexterous using ggplot2 and R in general - hopefully you are too! But, I am also learning to think differently about how to solve problems. I think this latter point is far more important than the mechanics of how to generate a figure.

After discussing the “fan plot” with you last week, I went about making it for the video that will be posted on Monday. I was able to make it using a stacked bar plot made with geom_col() and coord_radial(). But when I went to customize its appearance to add the legend, my original plans went out the window. Now what? I have to admit that at one point I did consider skipping making the plot for the video. But then I remembered it was in last week’s newsletter and people would be expecting it. So I got to work. I recalled that there’s a geom_polygon() function and with a little trigonometry, I was able to make the fan plot. We’re going to see geom_polygon() a few more times during this series of episodes including for today’s figure :)

This week, I want you to consider an iconic visual from the collection that is actually on the cover of the (Battle-Baptiste and Rusert book). This is Plate 25

This plot is a bit beyond a simple description. It reminded me of Dorothoy’s trip out of Munchkin Land where there are multiple roads, but she has to follow the “yellow brick road”. Except those roads go out from the Munchkins. These roads all circle inward. Regardless, we might call this a circular bar plot. There were a few strategies that stood out to me.

First, I could represent each bar as a line. I’d make the lines thick so that they resembled bars. With this approach, I would start by making 5 diagonal lines in Cartesian coordinates. Then I’d use coord_radial() to get them to circle on themselves. Why diagonal? Well, because if they were horizontal or vertical, then we’d get circles when plotted in polar coordinates. By making them diagonal they would circle inward. I could play with the slope to get the proper tightness of the spiral. But, I notice that these bars have a thin outer edge that I can’t get with a line. Perhaps I could plot each category twice - once in black and the on top of that with the desired color using a slightly smaller line thickness. This seems too kludgy.

Second, I could take the same strategy as the line plot, but use geom_rect() to create diagonal bars similar to the lines of the previous approach. Then I could draw those bars in polar coordinates. This would allow me to set the fill and border colors separately to have the thin black border that DuBois included. This could work. The challenge with going between Cartesian and polar coordinates is that things get a bit hacky.

Third, to avoid going back and forth between coordinate schemes, we could do everything in Cartesian coordinates. We would still need to use angles and radii to draw the spirals. The outer and inner edge of each spiral would have their own radius and the beginning and end of each spiral its own angle. Using the seq() function we could generate paired angles and radius values for each edge of each spiral. With those radii and angles, we can calculate x and y-axis positions using r * cos(theta) and r * sin(theta), respectively. I’d have the angle values start at pi / 2 or 12:00 and end at 17 * pi / 4, which, if I have my math right, is basically where the red spiral ends. Then, I’d scale the length of each spiral to the length of the red spiral. We can calculate the length of the spiral using sqrt(diff(x)^2 + diff(y)^2). We could then draw the spirals using geom_polygon().

There are three strategies. See if you can get one of these to work! Let me know what you find ;)

The legend at the start of the spiral is deceptively simple! If the font were monospaced, it would be somewhat straightforward to get everything line up. But it isn’t. Also, the line connecting the year and the amount of money isn’t merely a series of dashes, but actually a short line segment. Perhaps dashes would be fine if you weren’t so concerned with matching the original. Now that I think about it, I wonder how to generate straight lines with geom_segment() in polar coordinates. This might be an argument in favor of my third strategy above.

Again, I’m not sure that I would ever create a plot like this for my own data. But, it has definitely gotten me thinking far differently than I normally do with my data visualizations. That’s what make it so much fun for me. Here’s some code to help you get going.

library(tidyverse)

tribble(
~year,~value,
1875,21186,
1880,498532,,
1885,736160,
1890,1173624,
1895,1322694,
1899,1434975
)

If you thought this was fun, I’d encourage you to check out Plate 17. How would you go about generating that final serpentine bar for the “Industrial” category?

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