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! Sorry for the hiatus in getting you a newsletter into your inbox. The end of the summer/beginning of the academic year has been pretty chaotic. Actually, I had what I thought would be an interesting plot to recreate, but then I wasn’t able to find the original data and I wasn’t really interested in simulating it. Oh well. I’m also finding it hard to come up with interesting data visualizations from out in the wild. One of my go-to’s, Philip Bump, stopped working for the Washington...

Hey folks! The summer is nearly over - where did it go?! Many of us are getting ready to send our kids off to school and start a new academic year. If you’re subscribed to this newsletter, I suspect you are interested in improving your data visualization skills. You can certainly continue to receive this newsletter and watch my weekly livestreams on YouTube for free to help increase those skills. If you want a more concentrated or personalized opportunity to develop your data visualization...

Hey folks! I’d love to have you join me in September for a new approach to teaching workshops that I will be rolling out. For five weeks I’ll be working with two cohorts of you all to improve our data visualization skills. Each week we’ll meet for a two-hour session. These sessions will include instruction on principles and concepts in data visualization and an opportunity to apply this information to visualizations we find in the wild or that you bring to the group. By not talking about...