[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Recreating the the data visualization of W.E.B Du Bois from the 1900 Paris Exposition using modern tools.
https://github.com/ajstarks/dubois-data-portraits/tree/master/challenge/2024
< section id="config" class="level2">Config
library(tidyverse) library(janitor) library(showtext) library(glue) _add_google("Play", family = "dubois") showtext_auto() options(scipen = 100)
Data
data_03 <- read_csv("data.csv") |> clean_names() |> arrange(desc(date)) |> mutate(date = fct_inorder(factor(date)))
Plot
data_03 |> ggplot(aes(date, land)) + geom_col(width = .5, fill = "#CB2A44", color = "#CB2A44") + geom_text(data = bind_rows(slice_min(data_03, date, n = 1), slice_max(data_03, date, n = 1)), aes(label = format(after_stat(y), big.mark = ",")), family = "dubois", size = 5, position = position_stack(vjust = 0.5)) + scale_x_discrete() + coord_flip(ylim = c(0, NA), expand = FALSE) + labs(title = str_to_upper("Acres of land owned by negroes\nin Georgia."), x = "", y = "", caption = glue("https://r.iresmi.net/ - {Sys.Date()} inspired by W.E.B Du Bois data: https://github.com/ajstarks/dubois-data-portraits/tree/master/challenge/2024")) + theme_minimal() + theme(text = element_text(family = "dubois", size = 20, lineheight = .5), panel.background = element_rect(fill = NA, color = NA), panel.grid = element_blank(), axis.text.x = element_blank(), axis.text.y = element_text(size = 15), plot.title = element_text(size = 20, hjust = 0.5), plot.background = element_rect(fill = "#E6D4C3", color = NA), plot.margin = margin(.2, .3, .1, .3, "cm"), plot.caption = element_text(size = 10), plot.caption.position = "plot")
To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.