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 are some videos 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, This has been a busy week! I’ve been on campus teaching a 3 day, all day, R class. It’s been a while since I’ve done one of these live workshops off campus. If you’re interested in me coming to your campus, you coming to Michigan, or being in a Zoom-based workshop, please let me know! I really love being able to interact with you all in workshops. If your experience has been at all like my own the past month or so, your conversations have all had a tinge of anxiety about the...

Hey folks, I really hope you enjoyed the series of newsletters and videos of me recreating the visualizations presented by W.E.B. DuBois at the 1900 Paris Exposition. I can’t express how much I enjoyed making them. Some of them were pretty tricky and required a lot of work. But I think it was worth it! It definitely forced me to use some new-to-me tools like geom_polygon() and geom_sf(). Please let me know what you thought of the series! I wonder if there’d be any interest in a companion to...

Hey folks, I can’t tell you how much I’ve enjoyed recreating the “data portraits” from the collection of visualizations that WEB DuBois and his colleagues presented at the 1900 Paris Exposition. 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). Perhaps this isn’t so obvious to my non-US readers and viewers, but February is Black History month. In...