MENU

Fun & Interesting

How to recreate WEB DuBois's Panel 12 from the 1900 Paris Exposition using R and ggplot2 (CC340)

Riffomonas Project 718 lượt xem 2 months ago
Video Not Working? Fix It Now

Pat recreates an iconic figure that WEB DuBois presented at the 1900 Paris Exposition showing the change in the percentage of Blacks who were free in Georgia between 1790 and 1870 using tools from R's ggplot2, dplyr, and showtext. The functions he uses from these packages include aes, annotate, arrange, as.character, coord_cartesian, element_blank, element_line, element_rect, element_text, factor, fill, font_add, full_join, geom_area, geom_hline, geom_path, geom_text, ggplot, ggsave, if_else, labs, lead, length, library, margin, mutate, paste0, pivot_longer, runif, scale_fill_manual, scale_x_continuous, scale_y_continuous, select, seq, showtext_auto, showtext_opts, theme, tibble, and tribble. You can find the data and code he developed in this episode at https://www.riffomonas.org/code_club/2025-02-10-panel-12. Pat's newsletter describing how he would go about generating the figure can be found at https://shop.riffomonas.org/posts/remaking-classic-hand-drawn-data-visualizations-from-1900. The book Pat mentions by Whitney Battle-Baptiste and Britt Rusert, titled "W.E.B. Du Bois's Data Portraits: Visualizing Black America" is available at https://amzn.to/4heJOWZ. A great set of talks about the DuBois data portraits is available at https://www.youtube.com/watch?v=ZZST1AZj-dQ&ab_channel=Tableau. The Anthony Starks GitHub repository can be found at https://github.com/ajstarks/dubois-data-portraits/. If you have a figure that you would like to see me discuss in a future newsletter and episode of Code Club, email me at pat@riffomonas.org!

Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at https://shop.riffomonas.org/youtube to get practice problems, tips, and insights. If you're interested in purchasing a video workshop be sure to check out https://riffomonas.org/workshops/

Support Riffomonas by becoming a Patreon member!
https://www.patreon.com/riffomonas

You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: https://www.riffomonas.org/minimalR/
General data: https://www.riffomonas.org/generalR/

If you want to cite this video, please consider citing https://journals.asm.org/doi/10.1128/mra.01310-22

0:00 Introduction
7:36 Install special fonts to match DuBois
12:19 Making an initial version of the area chart
16:00 Creating a "rip" in the data at ~3%
27:56 Flipping order of x and y-axes
30:19 Modifying appearance of title and axes
35:58 Adding percentages to right-hand margin
45:50 Replicating lines from DuBois figure

Comment