├── 2021
├── images
│ ├── challenge_01.jpg
│ ├── challenge_02.jpg
│ ├── challenge_03.jpg
│ ├── challenge_04.jpg
│ ├── challenge_05.jpg
│ ├── challenge_06.jpg
│ ├── challenge_07.jpg
│ ├── challenge_08.jpg
│ ├── challenge_09.jpg
│ ├── challenge_10.jpg
│ ├── original_01.jpg
│ ├── original_02.jpg
│ ├── original_03.jpg
│ ├── original_04.jpg
│ ├── original_05.jpg
│ ├── original_06.jpg
│ ├── original_07.jpg
│ ├── original_08.jpg
│ ├── original_09.jpg
│ └── original_10.jpg
├── challenge_06.R
├── challenge_04.R
├── challenge_01.R
├── challenge_07.R
├── README.md
├── challenge_10.R
├── challenge_03.R
├── challenge_08.R
├── challenge_09.R
├── challenge_02.R
└── challenge_05.R
├── 2022
├── images
│ ├── challenge_01.jpg
│ ├── challenge_02.jpg
│ ├── challenge_03.jpg
│ ├── challenge_04.jpg
│ ├── challenge_05.jpg
│ ├── challenge_06.jpg
│ ├── challenge_07.jpg
│ ├── challenge_08.jpg
│ ├── challenge_09.jpg
│ ├── challenge_10.jpg
│ ├── original_01.jpg
│ ├── original_02.jpg
│ ├── original_03.jpg
│ ├── original_04.jpg
│ ├── original_05.jpg
│ ├── original_06.jpg
│ ├── original_07.jpg
│ ├── original_08.jpg
│ ├── original_09.jpg
│ └── original_10.jpg
├── challenge_06.R
├── challenge_03.R
├── challenge_05.R
├── challenge_08.R
├── README.md
├── challenge_10.R
├── challenge_09.R
├── challenge_02.R
├── challenge_07.R
├── challenge_04.R
└── challenge_01.R
├── .gitignore
├── dubois_challenge.Rproj
├── README.md
└── LICENSE.md
/2021/images/challenge_01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/challenge_01.jpg
--------------------------------------------------------------------------------
/2021/images/challenge_02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/challenge_02.jpg
--------------------------------------------------------------------------------
/2021/images/challenge_03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/challenge_03.jpg
--------------------------------------------------------------------------------
/2021/images/challenge_04.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/challenge_04.jpg
--------------------------------------------------------------------------------
/2021/images/challenge_05.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/challenge_05.jpg
--------------------------------------------------------------------------------
/2021/images/challenge_06.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/challenge_06.jpg
--------------------------------------------------------------------------------
/2021/images/challenge_07.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/challenge_07.jpg
--------------------------------------------------------------------------------
/2021/images/challenge_08.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/challenge_08.jpg
--------------------------------------------------------------------------------
/2021/images/challenge_09.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/challenge_09.jpg
--------------------------------------------------------------------------------
/2021/images/challenge_10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/challenge_10.jpg
--------------------------------------------------------------------------------
/2021/images/original_01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/original_01.jpg
--------------------------------------------------------------------------------
/2021/images/original_02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/original_02.jpg
--------------------------------------------------------------------------------
/2021/images/original_03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/original_03.jpg
--------------------------------------------------------------------------------
/2021/images/original_04.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/original_04.jpg
--------------------------------------------------------------------------------
/2021/images/original_05.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/original_05.jpg
--------------------------------------------------------------------------------
/2021/images/original_06.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/original_06.jpg
--------------------------------------------------------------------------------
/2021/images/original_07.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/original_07.jpg
--------------------------------------------------------------------------------
/2021/images/original_08.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/original_08.jpg
--------------------------------------------------------------------------------
/2021/images/original_09.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/original_09.jpg
--------------------------------------------------------------------------------
/2021/images/original_10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2021/images/original_10.jpg
--------------------------------------------------------------------------------
/2022/images/challenge_01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/challenge_01.jpg
--------------------------------------------------------------------------------
/2022/images/challenge_02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/challenge_02.jpg
--------------------------------------------------------------------------------
/2022/images/challenge_03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/challenge_03.jpg
--------------------------------------------------------------------------------
/2022/images/challenge_04.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/challenge_04.jpg
--------------------------------------------------------------------------------
/2022/images/challenge_05.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/challenge_05.jpg
--------------------------------------------------------------------------------
/2022/images/challenge_06.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/challenge_06.jpg
--------------------------------------------------------------------------------
/2022/images/challenge_07.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/challenge_07.jpg
--------------------------------------------------------------------------------
/2022/images/challenge_08.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/challenge_08.jpg
--------------------------------------------------------------------------------
/2022/images/challenge_09.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/challenge_09.jpg
--------------------------------------------------------------------------------
/2022/images/challenge_10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/challenge_10.jpg
--------------------------------------------------------------------------------
/2022/images/original_01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/original_01.jpg
--------------------------------------------------------------------------------
/2022/images/original_02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/original_02.jpg
--------------------------------------------------------------------------------
/2022/images/original_03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/original_03.jpg
--------------------------------------------------------------------------------
/2022/images/original_04.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/original_04.jpg
--------------------------------------------------------------------------------
/2022/images/original_05.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/original_05.jpg
--------------------------------------------------------------------------------
/2022/images/original_06.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/original_06.jpg
--------------------------------------------------------------------------------
/2022/images/original_07.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/original_07.jpg
--------------------------------------------------------------------------------
/2022/images/original_08.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/original_08.jpg
--------------------------------------------------------------------------------
/2022/images/original_09.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/original_09.jpg
--------------------------------------------------------------------------------
/2022/images/original_10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nrennie/dubois_challenge/HEAD/2022/images/original_10.jpg
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | .Ruserdata
5 | 2021/data/
6 | 2021/animation_images/
7 | 2021/dubois.gif
8 | 2022/data/
9 | 2022/animation_images/
10 | 2022/dubois.gif
--------------------------------------------------------------------------------
/dubois_challenge.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | DuBois Challenge
3 |
4 | The DuBois Challenge is part of a celebration of the data visualization legacy of W.E.B DuBois which attempts to recreate the visualizations from the 1900 Paris Exposition using modern tools. Check out the challenge [here](https://github.com/ajstarks/dubois-data-portraits/blob/master/challenge/README.md).
--------------------------------------------------------------------------------
/2022/challenge_06.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(showtext)
3 |
4 | # load data
5 | df <- readr::read_csv("2022/data/06.csv")
6 |
7 | # load fonts
8 | font_add_google(name = "Space Mono", family = "space")
9 | showtext_auto()
10 |
11 | # plot
12 | p <- ggplot(data = df,
13 | mapping = aes(x = `Iliteracy Rate`, y = Date)) +
14 | geom_segment(aes(y = 1950, yend = Date, x = `Iliteracy Rate`, xend = `Iliteracy Rate`),
15 | size = 2) +
16 | geom_segment(aes(y = Date, yend = Date, x = 100, xend = `Iliteracy Rate`-1),
17 | size = 2, colour = "#dac8b8") +
18 | # line borders
19 | geom_segment(aes(y = Date+0.8, yend = Date+0.8, x = 101, xend = `Iliteracy Rate`-1),
20 | size = 0.2, colour = "black") +
21 | geom_segment(aes(y = Date-0.8, yend = Date-0.8, x = 101, xend = `Iliteracy Rate`-1),
22 | size = 0.2, colour = "black") +
23 | geom_segment(aes(y = Date-0.8, yend = Date+0.8, x = `Iliteracy Rate`-1, xend = `Iliteracy Rate`-1),
24 | size = 0.2) +
25 | #scales
26 | scale_y_reverse(limits = c(1950, 1858),
27 | breaks = c(1950, df$Date),
28 | labels = c("PERCENT OF\nILLITERACY", df$Date[1:4], "(1900?)")) +
29 | scale_x_reverse(breaks = df$`Iliteracy Rate`,
30 | labels = c(paste0(df$`Iliteracy Rate`[1:4], "%"), "(50%?)")) +
31 | coord_cartesian(expand = T) +
32 | labs(x = "",
33 | y = "",
34 | title = "ILLITERACY.") +
35 | theme(plot.background = element_rect(fill = "#dac8b8", colour="#dac8b8"),
36 | panel.background = element_rect(fill = "#dac8b8", colour="#dac8b8"),
37 | panel.grid.major = element_blank(),
38 | panel.grid.minor = element_blank(),
39 | plot.title = element_text(family = "space", face = "bold", hjust = 0.3, size = 24),
40 | axis.title = element_text(family = "space", hjust = 0.5),
41 | axis.text.x = element_text(margin = margin(t = -10), size = 16),
42 | axis.text.y = element_text(lineheight = 0.4, size = 16),
43 | axis.ticks = element_blank(),
44 | plot.margin = unit(c(1.0, 2.0, 1.2, 2.0), "cm"))
45 |
46 | p
47 |
48 | ggsave(p, filename = "2022/images/challenge_06.jpg", height = 5, width = 4, unit = "in")
49 |
50 |
--------------------------------------------------------------------------------
/2022/challenge_03.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(showtext)
3 | library(sf)
4 |
5 | # load data
6 | df <- readr::read_csv("2022/data/03.csv")
7 | s_file <- st_read(dsn = "2022/data/s_11au16/s_11au16.shp")
8 |
9 | # load fonts
10 | font_add_google(name = "Space Mono", family = "space")
11 | showtext_auto()
12 |
13 | # Join map data
14 | df <- df %>%
15 | rename("STATE" = "State")
16 | df[8,2] <- "100,000 - 200,000"
17 | map_data1 <- inner_join(s_file, df, by = "STATE")
18 | map_data1$Population = factor(map_data1$Population,
19 | levels = c("750,000 AND OVER", "100,000 - 200,000",
20 | "600,000 - 750,000", "50,000 - 100,000",
21 | "500,000 - 600,000", "25,000 - 50,000",
22 | "300,000 - 500,000", "10,000 - 25,000",
23 | "200,000 - 300,000", "UNDER - 10,000"))
24 |
25 | # Plot data
26 | p <- ggplot() +
27 | geom_sf(data=map_data1,
28 | mapping = aes(fill = Population),
29 | colour="black", size = 0.08) +
30 | labs(title = "RELATIVE NEGRO POPULATION OF THE STATES OF THE\nUNITED STATES.") +
31 | scale_fill_manual(values = c("#242220", "#d8bea7", "#938270", "#c3042a", "#dbccbb",
32 | "#e5c2b4", "#795640", "#eeb455", "#2e255f", "#d3d3d3")) +
33 | guides(fill=guide_legend(ncol=2, byrow = TRUE)) +
34 | theme(plot.background = element_rect(fill = "#dac8b8", colour="#dac8b8"),
35 | panel.background = element_rect(fill = "#dac8b8", colour="#dac8b8"),
36 | panel.grid.major = element_blank(),
37 | panel.grid.minor = element_blank(),
38 | legend.position = "bottom",
39 | legend.title = element_blank(),
40 | legend.background = element_rect(fill = "#dac8b8", colour="#dac8b8"),
41 | legend.text = element_text(family = "space", size = 14, margin = margin(r = 20)),
42 | legend.spacing.y = unit(0.3, 'cm'),
43 | legend.key.size = unit(0.3, 'cm'),
44 | legend.key = element_rect(size = 1),
45 | plot.title = element_text(family = "space", face = "bold",
46 | hjust = 0.5, size = 24,
47 | lineheight = 0.3,
48 | margin = margin(b = 60)),
49 | axis.text = element_blank(),
50 | axis.ticks = element_blank(),
51 | plot.margin = unit(c(0.1, 0.8, 0.3, 0.8), "cm"))
52 |
53 | ggsave(p, filename = "2022/images/challenge_03.jpg", height = 5, width = 4, unit = "in")
54 |
--------------------------------------------------------------------------------
/2022/challenge_05.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(showtext)
3 |
4 | # load data
5 | df <- readr::read_csv("2022/data/05.csv")
6 |
7 | # load fonts
8 | font_add_google(name = "Space Mono", family = "space")
9 | showtext_auto()
10 |
11 | # prep data
12 | df_long <- df %>%
13 | mutate(Slave = Slave - 97) %>%
14 | pivot_longer(cols = c(Slave, Free), names_to = "Type", values_to = "perc") %>%
15 | mutate(Type = factor(Type, levels = c("Slave", "Free")))
16 | df_long[17, 3] <- 0.000001
17 | df_long[18, 3] <- 3 - 0.000001
18 | df_long <- df_long %>%
19 | add_row(Year = 1863, Type = "Slave", perc = 0.000001) %>%
20 | add_row(Year = 1863, Type = "Free", perc = (3 - 0.000001)) %>%
21 | mutate(Type = factor(Type, levels = c("Slave", "Free")))
22 |
23 |
24 | df_wide <- df %>%
25 | mutate(Slave = Slave - 97,
26 | label = paste0(df_wide$Free, c("%", rep("", 7), "%")))
27 |
28 | # plot
29 | p <- ggplot() +
30 | geom_area(data = df_long, aes(x = Year, y = perc, fill = Type)) +
31 | geom_text(data = df_wide, aes(x = Year, y = -0.3, label = label), family="space", size = 5) +
32 | geom_segment(data = filter(df_long, Year != 1863), aes(x = Year, xend = Year, y = 0, yend = 3), colour = "#ddccbb", size = 0.3) +
33 | annotate("text", x = 1788, y = c(1, 2, 3), label = paste(1:3, "%", sep = ""), family="space", size = 5) +
34 | annotate("text", x = 1787, y = -0.3, label = "PERCENT\nOF\nFREE NEGROES", family="space", size = 4, lineheight = 0.3) +
35 | labs(title = "SLAVES AND FREE NEGROES.",
36 | x = "", y = "") +
37 | scale_fill_manual("", values = c("Slave" = "#101010", "Free" = "#cf334e")) +
38 | scale_x_reverse(breaks = c(seq(1870,1790,-10)), limits = c(1873, 1787)) +
39 | scale_y_reverse(position = "right", limits=c(NA,-0.5), breaks = c(1:3), labels = c("", "", "")) +
40 | coord_flip() +
41 | theme(plot.background = element_rect(fill = "#ddccbb", colour="#ddccbb"),
42 | panel.background = element_rect(fill = "#ddccbb", colour="#ddccbb"),
43 | legend.position = "none",
44 | axis.ticks = element_blank(),
45 | panel.grid.minor = element_blank(),
46 | panel.grid.major = element_blank(),
47 | plot.margin = unit(c(0.5, 2.5, 1.2, 2.5), "cm"),
48 | plot.title = element_text(colour = "black", size=24, face = "bold",
49 | hjust = 0.4, family="space", margin = margin(b = -10)),
50 | axis.text = element_text(colour = "black", size=16, hjust = 0.5, family="space"),
51 | axis.text.x = element_text(margin = margin(c(-80, -80, -80, -80))))
52 | p
53 |
54 | ggsave(p, filename = "2022/images/challenge_05.jpg", height = 5, width = 4, unit = "in")
55 |
--------------------------------------------------------------------------------
/2021/challenge_06.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(ggplot2)
3 | library(extrafont)
4 | tuesdata <- tidytuesdayR::tt_load('2021-02-16')
5 | city_rural <- tuesdata$city_rural
6 |
7 |
8 | theta <- seq(7,11.25*pi,0.01)
9 | r <- 0.5 + 0.5*theta
10 | df <- data.frame(x=r*cos(theta), y=r*sin(-theta)) # Cartesian coords
11 | p <- ggplot() + geom_point(data=df, aes(x,y), col='red3', size=1.5) +
12 | labs(title="CITY AND RURAL POPULATION.\n1890.\n\n") +
13 | xlim(-45,45) + ylim(-50,60) +
14 | geom_segment(aes(x = df[nrow(df),1], y = df[nrow(df),2], xend = 10, yend = 40), col='red3', size=1.5) +
15 | geom_segment(aes(x = 10, y = 40, xend = -5, yend = 55), col='gold2', size=1.5) +
16 | geom_segment(aes(x = -5, y = 55, xend = 0, yend = 60), col='dodgerblue4', size=1.5) +
17 | geom_segment(aes(x = 0.7, y = 60, xend = -35, yend = 60), col='forestgreen', size=1.5) +
18 | annotate("text", x=0, y=0, label="734,952", col="black", size=2) +
19 | annotate("text", x=-22, y=57, label="78,139 NEGROES IN CITIES\nOF OVER 10,000 INHABITANTS", col="black", size=2, hjust=0.5) +
20 | annotate("text", x=0, y=57, label="8,025", col="black", size=2, hjust=0, vjust=0.5) +
21 | annotate("text", x=5, y=57, label="NEGROES IN CITIES\nFROM 5,000 TO 10,000", col="black", size=2, hjust=0, vjust=0.5) +
22 | annotate("text", x=-5, y=45, label="37,699\nNEGROES\nIN CITIES\nFROM\n2,500 TO 5,000", col="black", size=2, hjust=0.5) +
23 | annotate("text", x=0, y=-20, label="NEGROES LIVING IN THE COUNTRY AND VILLAGES", col="black", size=2, hjust=0.5) +
24 | theme(panel.background = element_rect(fill = "#d0bba8"),
25 | plot.background = element_rect(fill = "#d0bba8"),
26 | legend.background = element_rect(fill = "#d0bba8"),
27 | plot.title = element_text(colour = "black", size=12, face="bold", hjust = 0.5),
28 | plot.subtitle = element_text(colour = "black", size=10, face="bold", hjust = 0.5),
29 | legend.title = element_blank(),
30 | legend.position="none",
31 | plot.margin = unit(c(0.6, 0.1, 0, 0.1), "cm"), #top, right, bottom, left
32 | legend.key = element_rect(colour = "black"),
33 | legend.spacing.x = unit(0.5,"cm"),
34 | legend.text = element_text(colour="black", size=9),
35 | axis.title.x= element_blank(),
36 | axis.title.y= element_blank(),
37 | axis.text.x=element_blank(),
38 | axis.text.y=element_blank(),
39 | axis.ticks.x=element_blank(),
40 | axis.ticks.y=element_blank(),
41 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
42 | )
43 |
44 | p
45 |
46 | dev.new(width=4,height=6,unit="in", noRStudioGD = TRUE)
47 | ggsave(p, filename = "2021/images/challenge_06.jpg", bg = "transparent", height=6, width=4, unit="in")
48 |
--------------------------------------------------------------------------------
/2021/challenge_04.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(extrafont)
3 | tuesdata <- tidytuesdayR::tt_load('2021-02-16')
4 | freed_slaves <- tuesdata$freed_slaves
5 |
6 | d <- data.frame(year=freed_slaves$Year, slaves=freed_slaves$Slave, free=freed_slaves$Free, label=sapply(freed_slaves$Free, function(x) paste(x, "%", sep="")))
7 | p04 <- ggplot(data = d, aes(year)) +
8 | geom_ribbon(aes(ymin = rep(0,length(year)), ymax = slaves), fill="black") +
9 | geom_ribbon(aes(ymin = slaves, ymax = rep(100,length(year))), fill = "springgreen4") +
10 | geom_segment(aes(x=year, xend = year, y=0, yend = 100), colour=alpha("black", 0.2)) +
11 | ylim(0,105) +
12 | labs(title="PROPORTION OF FREEMEN AND SLAVES AMONG AMERICAN NEGROES .\n\nPROPORTION DES NÈGRES LIBRES ET DES ESCLAVES EN AMÉRIQUE .\n",
13 | subtitle="DONE BY ATLANTA UNIVERSITY\n") +
14 | geom_text(aes(x=year, y=c(slaves[1:length(slaves)-1],slaves[length(slaves)-1])+3, label=label), colour="black", size=4, fontface=2, family="Tw Cen MT Condensed") +
15 | geom_text(aes(x=year, y=103, label=year), colour="black", fontface=2, size=5, family="Tw Cen MT Condensed") +
16 | annotate("text", x = 1830, y = 55, label = "SLAVES", colour = "antiquewhite2", size=7, fontface=2, family="Tw Cen MT Condensed") +
17 | annotate("text", x = 1830, y = 50, label = "ESCLAVES", colour = "antiquewhite2", size=7, fontface=2, family="Tw Cen MT Condensed") +
18 | annotate("text", x = 1830, y = 96, label = "FREE - LIBRE", colour = "black", size=6, fontface=2, family="Tw Cen MT Condensed") +
19 | theme(panel.background = element_rect(fill = "antiquewhite2"),
20 | plot.background = element_rect(fill = "antiquewhite2"),
21 | legend.background = element_rect(fill = "antiquewhite2"),
22 | plot.title = element_text(colour = "black", size=12, face="bold", family="Tw Cen MT Condensed", hjust = 0.5),
23 | plot.subtitle = element_text(colour = "black", size=8, face="bold", hjust = 0.5, family="Tw Cen MT Condensed"),
24 | plot.margin = unit(c(0.2, 0.2, -0.4, 0.2), "cm"), #top, right, bottom, left
25 | legend.title = element_blank(),
26 | legend.position="none",
27 | legend.key = element_rect(size = 1.2, colour = "#c51b8a"),
28 | legend.text = element_text(colour="#c51b8a", size=12, family="Tw Cen MT Condensed"),
29 | axis.title.x= element_blank(),
30 | axis.title.y= element_blank(),
31 | axis.text.x=element_blank(),
32 | axis.text.y=element_blank(),
33 | axis.ticks.x=element_blank(),
34 | axis.ticks.y=element_blank(),
35 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
36 | )
37 | p04
38 |
39 | ggsave(p04, filename = "2021/images/challenge_04.jpg", height=6.25, width=5, unit="in")
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/2021/challenge_01.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(extrafont)
3 | library(ggpubr)
4 | library(pBrackets)
5 | library(grid)
6 | tuesdata <- tidytuesdayR::tt_load('2021-02-16')
7 | georgia_pop <- tuesdata$georgia_pop
8 |
9 | dev.new(width=5,height=6.25,unit="in", noRStudioGD = TRUE)
10 |
11 | p01 <- ggplot(data=georgia_pop,aes(x=Year)) +
12 | geom_line(aes(y=Colored, linetype="Colored")) +
13 | geom_line(aes(y=White, linetype="White")) +
14 | scale_y_reverse(breaks=seq(0,100,5), labels=seq(0,100,5), expand = c(0, 0)) +
15 | scale_linetype_manual("", values=c("Colored"="solid", "White"="dashed")) +
16 | annotate("text", x = 1790, y = 17, label = "\n\n\n\n\n\n\n\n\nWHITE", colour = alpha("black",0.5), size=2, family="Lucida Sans Typewriter") +
17 | annotate("text", x = 1790, y = 82, label = "\n\n\n\n\n\n\n\n\nCOLORED", colour = alpha("black",0.5), size=2, family="Lucida Sans Typewriter") +
18 | annotate("text", x = 1790, y = 5, label = "\n\n\n\n\n\n\n\n _ _ _ _", colour = alpha("black",0.5), size=2, family="Lucida Sans Typewriter") +
19 | annotate("text", x = 1790, y = 95, label = "\n\n\n\n\n\n\n\n_______", colour = alpha("black",0.5), size=2, family="Lucida Sans Typewriter") +
20 | scale_x_continuous(breaks=georgia_pop$Year, labels=georgia_pop$Year, limits=c(1790,1890), expand = c(0, 0)) +
21 | labs(title = "\nCOMPARATIVE INCREASE OF WHITE AND COLORED\nPOPULATION OF GEORGIA\n", y="\n\n\nPERCENTS") +
22 | coord_flip(ylim = c(100,0), clip = 'off') +
23 | theme(panel.background = element_rect(fill = "wheat2", color = alpha("black",0.3)),
24 | plot.background = element_rect(fill = "wheat2"),
25 | legend.background = element_rect(fill = "wheat2"),
26 | plot.title = element_text(colour = "black", size=11, hjust = 0.5, family="Lucida Sans Typewriter"),
27 | legend.title = element_blank(),
28 | legend.position="none",
29 | legend.justification=c(0.5,0),
30 | plot.margin = unit(c(0.2, 2, 1.5, 2), "cm"), #top, right, bottom, left
31 | legend.key = element_rect(fill = "wheat2"),
32 | legend.spacing.x = unit(0.1,"cm"),
33 | legend.text = element_text(colour=alpha("black",0.5), size=6, family="Lucida Sans Typewriter", margin = margin(r = 100, unit = "pt")),
34 | axis.title.x= element_text(colour=alpha("black",0.5), size=6, family="Lucida Sans Typewriter"),
35 | axis.title.y= element_blank(),
36 | axis.ticks = element_blank(),
37 | axis.text.x=element_text(colour=alpha("black",0.5), size=4, family="Lucida Sans Typewriter"),
38 | axis.text.y=element_text(colour=alpha("black",0.5), size=6, family="Lucida Sans Typewriter"),
39 | panel.grid.minor = element_blank(),
40 | panel.grid.major = element_line(colour=alpha("red1",0.2))
41 | )
42 | p01
43 |
44 | #grid.locator(unit="native")
45 | grid.brackets(410, 490, 90, 490, lwd=0.5, col="gray57")
46 |
47 | ggsave(p01, filename = "2021/images/challenge_01.jpg", height=6.25, width=5, unit="in")
48 |
--------------------------------------------------------------------------------
/2022/challenge_08.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(showtext)
3 |
4 | # load data
5 | furniture <- readr::read_csv("2022/data/08.csv")
6 |
7 | # load fonts
8 | font_add_google(name = "Space Mono", family = "space")
9 | showtext_auto()
10 |
11 | # make spirals
12 | theta1 <- seq(2.7,4.5*pi,0.01)
13 | r1 <- 0.5 + 0.5*theta1
14 | df1 <- data.frame(x=r1*cos(theta1), y=r1*sin(theta1))
15 |
16 | theta2 <- seq(4.6,4.5*pi,0.01)
17 | r2 <- 1 + 0.5*theta2
18 | df2 <- data.frame(x=r2*cos(theta2), y=r2*sin(theta2))
19 |
20 | theta3 <- seq(6.5,4.5*pi,0.01)
21 | r3 <- 1.5 + 0.5*theta3
22 | df3 <- data.frame(x=r3*cos(theta3), y=r3*sin(theta3))
23 |
24 | theta4 <- seq(10,4.5*pi,0.01)
25 | r4 <- 2 + 0.5*theta4
26 | df4 <- data.frame(x=r4*cos(theta4), y=r4*sin(theta4))
27 |
28 | theta5 <- seq(11.5,4.5*pi,0.01)
29 | r5 <- 2.5 + 0.5*theta5
30 | df5 <- data.frame(x=r5*cos(theta5), y=r5*sin(theta5))
31 |
32 | theta6 <- seq(14,4.5*pi,0.01)
33 | r6 <- 3 + 0.5*theta6
34 | df6 <- data.frame(x=r6*cos(theta6), y=r6*sin(theta6))
35 |
36 | p <- ggplot() +
37 | geom_point(data=df1, aes(x,y), col='red3', size=2) +
38 | geom_point(data=df2, aes(x,y), col='gray75', size=2) +
39 | geom_point(data=df3, aes(x,y), col='gold3', size=2) +
40 | geom_point(data=df4, aes(x,y), col='gray60', size=2) +
41 | geom_point(data=df5, aes(x,y), col='lightskyblue3', size=2) +
42 | geom_point(data=df6, aes(x,y), col='lightpink1', size=2) +
43 | labs(title="ASSESSED VALUE OF HOUSEHOLD AND KITCHEN FURNITURE\nOWNED BY GEORGIA NEGORES.\n\n") +
44 | xlim(-10.5,10.5) + ylim(-10.5,10.5) +
45 | coord_fixed() +
46 | geom_text(data=data.frame(x=rep(-4.5,6), y=rev(seq(7.6,10.1,0.5))),
47 | label=c("1875", "1880", "1885", "1890", "1895", "1899"),
48 | aes(x=x, y=y, label=label), family="space", size=2.5, hjust=0, colour="black") +
49 | geom_text(data=data.frame(x=rep(-0.4,6), y=rev(seq(7.6,10.1,0.5))),
50 | label=c("----- $ 21,186", "---- $ 498,532", "--- $ 736,170", "-- $ 1,173,624", "-- $ 1,322,694", "-- $ 1,434,975"),
51 | aes(x=x, y=y, label=label), family="space", size=2.5, hjust=1, colour="black") +
52 | theme(panel.background = element_rect(fill = "#d0bba8", colour = "#d0bba8"),
53 | plot.background = element_rect(fill = "#d0bba8", colour = "#d0bba8"),
54 | plot.title = element_text(colour = "black", size=20, face="bold", hjust = 0.5, family="space", lineheight = 0.5),
55 | legend.position="none",
56 | plot.margin = unit(c(0.7, 0.1, 1.8, 0.1), "cm"), #top, right, bottom, left
57 | axis.title.x= element_blank(),
58 | axis.title.y= element_blank(),
59 | axis.text.x=element_blank(),
60 | axis.text.y=element_blank(),
61 | axis.ticks.x=element_blank(),
62 | axis.ticks.y=element_blank(),
63 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
64 | )
65 |
66 | p
67 |
68 | ggsave(p, filename = "2022/images/challenge_08.jpg", height = 5, width = 4, unit = "in")
69 |
--------------------------------------------------------------------------------
/2021/challenge_07.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(ggplot2)
3 | library(extrafont)
4 | tuesdata <- tidytuesdayR::tt_load('2021-02-16')
5 | furniture <- tuesdata$furniture
6 |
7 | theta1 <- seq(2.7,4.5*pi,0.01)
8 | r1 <- 0.5 + 0.5*theta1
9 | df1 <- data.frame(x=r1*cos(theta1), y=r1*sin(theta1))
10 |
11 | theta2 <- seq(4.6,4.5*pi,0.01)
12 | r2 <- 1 + 0.5*theta2
13 | df2 <- data.frame(x=r2*cos(theta2), y=r2*sin(theta2))
14 |
15 | theta3 <- seq(6.5,4.5*pi,0.01)
16 | r3 <- 1.5 + 0.5*theta3
17 | df3 <- data.frame(x=r3*cos(theta3), y=r3*sin(theta3))
18 |
19 | theta4 <- seq(10,4.5*pi,0.01)
20 | r4 <- 2 + 0.5*theta4
21 | df4 <- data.frame(x=r4*cos(theta4), y=r4*sin(theta4))
22 |
23 | theta5 <- seq(11.5,4.5*pi,0.01)
24 | r5 <- 2.5 + 0.5*theta5
25 | df5 <- data.frame(x=r5*cos(theta5), y=r5*sin(theta5))
26 |
27 | theta6 <- seq(14,4.5*pi,0.01)
28 | r6 <- 3 + 0.5*theta6
29 | df6 <- data.frame(x=r6*cos(theta6), y=r6*sin(theta6))
30 |
31 | p <- ggplot() +
32 | geom_point(data=df1, aes(x,y), col='red3', size=4) +
33 | geom_point(data=df2, aes(x,y), col='gray75', size=4) +
34 | geom_point(data=df3, aes(x,y), col='gold3', size=4) +
35 | geom_point(data=df4, aes(x,y), col='gray60', size=4) +
36 | geom_point(data=df5, aes(x,y), col='lightskyblue3', size=4) +
37 | geom_point(data=df6, aes(x,y), col='lightpink1', size=4) +
38 | labs(title="ASSESSED VALUE OF HOUSEHOLD AND KITCHEN FURNITURE\nOWNED BY GEORGIA NEGORES.\n\n") +
39 | xlim(-10.5,10.5) + ylim(-10.5,10.5) +
40 | geom_text(data=data.frame(x=rep(-4.5,6), y=rev(seq(7.6,10.1,0.5))),
41 | label=c("1875", "1880", "1885", "1890", "1895", "1899"),
42 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=2.5, hjust=0, colour="black") +
43 | geom_text(data=data.frame(x=rep(-0.4,6), y=rev(seq(7.6,10.1,0.5))),
44 | label=c("----- $ 21,186", "---- $ 498,532", "--- $ 736,170", "-- $ 1,173,624", "-- $ 1,322,694", "-- $ 1,434,975"),
45 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=2.5, hjust=1, colour="black") +
46 | theme(panel.background = element_rect(fill = "#d0bba8"),
47 | plot.background = element_rect(fill = "#d0bba8"),
48 | legend.background = element_rect(fill = "#d0bba8"),
49 | plot.title = element_text(colour = "black", size=12, face="bold", hjust = 0.5, family="Lucida Sans Typewriter"),
50 | plot.subtitle = element_text(colour = "black", size=10, face="bold", hjust = 0.5, family="Lucida Sans Typewriter"),
51 | legend.title = element_blank(),
52 | legend.position="none",
53 | plot.margin = unit(c(0.7, 0.1, 2, 0.1), "cm"), #top, right, bottom, left
54 | legend.key = element_rect(colour = "black"),
55 | legend.spacing.x = unit(0.5,"cm"),
56 | legend.text = element_text(colour="black", size=9),
57 | axis.title.x= element_blank(),
58 | axis.title.y= element_blank(),
59 | axis.text.x=element_blank(),
60 | axis.text.y=element_blank(),
61 | axis.ticks.x=element_blank(),
62 | axis.ticks.y=element_blank(),
63 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
64 | )
65 |
66 | p
67 |
68 | dev.new(width=6,height=8,unit="in", noRStudioGD = TRUE)
69 | ggsave(p, filename = "2021/images/challenge_07.jpg", bg = "transparent", height=8, width=6, unit="in")
70 |
--------------------------------------------------------------------------------
/2022/README.md:
--------------------------------------------------------------------------------
1 |
2 | DuBois Challenge 2022
3 |
4 | The DuBois Challenge is part of a celebration of the data visualization legacy of W.E.B DuBois which attempts to recreate the visualizations from the 1900 Paris Exposition using modern tools. Check out the challenge [here](https://github.com/ajstarks/dubois-data-portraits/blob/master/challenge/README.md).
5 |
6 |
7 | Challenge 1
8 |
9 | 
10 |
11 |
12 |
13 | Challenge 2
14 |
15 | 
16 |
17 |
18 |
19 | Challenge 3
20 |
21 | 
22 |
23 |
24 |
25 | Challenge 4
26 |
27 | 
28 |
29 |
30 |
31 | Challenge 5
32 |
33 | 
34 |
35 |
36 |
37 | Challenge 6
38 |
39 | 
40 |
41 |
42 |
43 | Challenge 7
44 |
45 | 
46 |
47 |
48 |
49 | Challenge 8
50 |
51 | 
52 |
53 |
54 |
55 | Challenge 9
56 |
57 | 
58 |
59 |
60 |
61 | Challenge 10
62 |
63 | 
64 |
--------------------------------------------------------------------------------
/2022/challenge_10.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(showtext)
3 |
4 | # load data
5 | df <- readr::read_csv("2022/data/10.csv")
6 |
7 | # load fonts
8 | font_add_google(name = "Space Mono", family = "space")
9 | showtext_auto()
10 |
11 | # prep data
12 | plot_df <- df %>%
13 | mutate(rel_size = c(0.6, 0.7, 1),
14 | red = `Percent Enrolled`*rel_size,
15 | black = 100*(1 - 0.01*`Percent Enrolled`)*rel_size,
16 | blank = 100 - (red + black)) %>%
17 | select(Year, red, black, blank) %>%
18 | pivot_longer(cols = c(red, black, blank),
19 | values_to = "prop",
20 | names_to = "type") %>%
21 | mutate(type = factor(type, levels = rev(c("blank", "black", "red"))))
22 |
23 | text_df <- data.frame(x = df$Year,
24 | y = c(90, 80, 70),
25 | label = paste0(df$`Percent Enrolled`, "%"))
26 |
27 | year_df <- data.frame(x = df$Year,
28 | y = rep(102, 3),
29 | label = df$Year)
30 |
31 | # plot
32 | p <- ggplot() +
33 | geom_col(data = plot_df,
34 | mapping = aes(x = Year, y = prop, fill = type),
35 | width = 5) +
36 | geom_text(data = text_df,
37 | mapping = aes(x = x, y = y, label = label),
38 | family = "space", fontface = "bold", size = 10) +
39 | geom_text(data = year_df,
40 | mapping = aes(x = x, y = y, label = label),
41 | family = "space", fontface = "bold", size = 9) +
42 | annotate("text", x = 1874, y = 23, label = "PROPORTION\nPROPORTION", hjust = 1, family = "space", lineheight = 0.5) +
43 | annotate("text", x = 1874, y = 9, label = "PROPORTION\nPROPORTION", hjust = 1, family = "space", lineheight = 0.5) +
44 | scale_fill_manual(values = c("blank" = "#dfd3c2", "red"="#cc0027", "black"="#0d0e0b"),
45 | breaks = c("red", "blank", "black"),
46 | labels = c("OF CHILDREN ENROLLED\nD'ENFANTS ENREGISTRES",
47 | "",
48 | "OF CHILDREN NOT ENROLLED\nD'ENFANTS NON ENREGISTRES")) +
49 | scale_x_continuous(limits = c(1870, 1901)) +
50 | labs(x = "", y = "",
51 | title = "PROPORTION OF TOTAL NEGRO CHILDREN OF SCHOOL AGE WHO ARE ENROLLED IN PUBLIC SCHOOLS.\n\nPROPORTION DES ENFANTS NEGRES EN AGE D'ECOLE ENREGISTRES DANS LES ECOLES PUBLIQUES.",
52 | subtitle = "\nDONE BY ATLANTA UNIVERSITY.") +
53 | theme(legend.position = c(0.35, 0.2),
54 | legend.background = element_rect(fill = "transparent", colour="transparent"),
55 | legend.title = element_blank(),
56 | legend.text = element_text(family = "space", hjust = 0, size = 12, lineheight = 0.5),
57 | legend.key = element_rect(fill = "#dfd3c2", colour="#dfd3c2"),
58 | plot.background = element_rect(fill = "#dfd3c2", colour="#dfd3c2"),
59 | panel.background = element_rect(fill = "#dfd3c2", colour="#dfd3c2"),
60 | panel.grid.major = element_blank(),
61 | panel.grid.minor = element_blank(),
62 | plot.title = element_text(family = "space", face = "bold", hjust = 0.5, lineheight = 0.5, size = 16),
63 | plot.subtitle = element_text(family = "space", hjust = 0.5),
64 | axis.title = element_blank(),
65 | axis.text = element_blank(),
66 | axis.ticks = element_blank(),
67 | plot.margin = unit(c(1, 0.5, 1, 0.5), "cm"))
68 | p
69 |
70 | ggsave(p, filename = "2022/images/challenge_10.jpg", height = 5, width = 4, unit = "in")
71 |
72 |
--------------------------------------------------------------------------------
/2021/README.md:
--------------------------------------------------------------------------------
1 |
2 | DuBois Challenge 2021
3 |
4 | The DuBois Challenge is part of a celebration of the data visualization legacy of W.E.B DuBois which attempts to recreate the visualizations from the 1900 Paris Exposition using modern tools. Check out the challenge [here](https://github.com/ajstarks/dubois-data-portraits/blob/master/challenge/README.md).
5 |
6 |
7 | Challenge 1
8 |
9 |
10 | 
11 |
12 |
13 |
14 | Challenge 2
15 |
16 |
17 | 
18 |
19 |
20 |
21 | Challenge 3
22 |
23 |
24 | 
25 |
26 |
27 |
28 | Challenge 4
29 |
30 |
31 | 
32 |
33 |
34 |
35 | Challenge 5
36 |
37 |
38 | 
39 |
40 |
41 |
42 | Challenge 6
43 |
44 |
45 | 
46 |
47 |
48 |
49 | Challenge 7
50 |
51 |
52 | 
53 |
54 |
55 |
56 | Challenge 8
57 |
58 |
59 | 
60 |
61 |
62 |
63 | Challenge 9
64 |
65 |
66 | 
67 |
68 |
69 |
70 | Challenge 10
71 |
72 |
73 | 
74 |
--------------------------------------------------------------------------------
/2022/challenge_09.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(showtext)
3 |
4 | # load data
5 | df <- readr::read_csv("2022/data/09.csv")
6 |
7 | # load fonts
8 | font_add_google(name = "Space Mono", family = "space")
9 | showtext_auto()
10 |
11 | # labels
12 | labels <- df %>%
13 | mutate(label = paste(CATEGORY, STUDENTS),
14 | y = 8:3,
15 | x = -1)
16 |
17 | # prep data
18 | df1 <- data.frame(x = seq(1, by = 0.1, length.out = 6),
19 | y = rep(8, 6))
20 |
21 | df2 <- data.frame(x = seq(1.7, by = 0.1, length.out = 49),
22 | y = rep(7, 49))
23 |
24 | df3 <- data.frame(x = seq(3.5, by = 0.1, length.out = 76),
25 | y = rep(6, 76))
26 |
27 | df4 <- data.frame(x = seq(2.0, by = 0.1, length.out = 80),
28 | y = rep(5, 80))
29 |
30 | df5 <- data.frame(x = seq(1.3, by = 0.1, length.out = 191),
31 | y = rep(4, 191))
32 |
33 | x1 <- seq(2.7, 41, by = 0.1)
34 | y1 <- rep(3, length(x1))
35 | x2 <- seq(-0.5, 41, by = 0.1)
36 | y2 <- rep(2.2, length(x2))
37 | x3 <- seq(-0.5, 18, by = 0.1)
38 | y3 <- rep(1.4, length(x3))
39 |
40 | df6 <- data.frame(x = c(x1),
41 | y = c(y1))
42 |
43 | df7 <- data.frame(x = c(x2),
44 | y = c(y2))
45 |
46 | df8 <- data.frame(x = c(x3),
47 | y = c(y3))
48 |
49 |
50 | p <- ggplot() +
51 | # points
52 | geom_line(data = df1, mapping = aes(x= x, y = y), size = 2, colour = "#976c50") +
53 | geom_line(data = df2, mapping = aes(x= x, y = y), size = 2, colour = "#976c50") +
54 | geom_line(data = df3, mapping = aes(x= x, y = y), size = 2, colour = "#976c50") +
55 | geom_line(data = df4, mapping = aes(x= x, y = y), size = 2, colour = "#976c50") +
56 | geom_line(data = df5, mapping = aes(x= x, y = y), size = 2, colour = "#976c50") +
57 | geom_line(data = df6, mapping = aes(x= x, y = y), size = 2, colour = "#976c50") +
58 | geom_line(data = df7, mapping = aes(x= x, y = y), size = 2, colour = "#976c50") +
59 | geom_line(data = df8, mapping = aes(x= x, y = y), size = 2, colour = "#976c50") +
60 | # curves
61 | geom_curve(aes(x = -0.5, y = 1.4, xend = -0.5, yend = 2.2),
62 | data = df6, curvature = -1, size = 2, colour = "#976c50") +
63 | geom_curve(aes(x = 41, y = 2.2, xend = 41, yend = 3),
64 | data = df6, curvature = 1, size = 2, colour = "#976c50") +
65 | #labels
66 | geom_text(data = labels, mapping = aes(x = -5, y = y, label = label),
67 | hjust = 0, family = "space") +
68 | labs(x = "",
69 | y = "",
70 | title = "NUMBER OF NEGRO STUDENTS TAKING\nTHE VARIOUS COURSES OF STUDY\nOFFERED IN GEORGIA SCHOOLS.") +
71 | scale_y_continuous(limits = c(0.5, 8.2)) +
72 | scale_x_continuous(limits = c(-5.5, 43)) +
73 | theme(plot.background = element_rect(fill = "#dac8b8", colour="#dac8b8"),
74 | panel.background = element_rect(fill = "#dac8b8", colour="#dac8b8"),
75 | panel.grid.major = element_blank(),
76 | panel.grid.minor = element_blank(),
77 | legend.position = "none",
78 | plot.title = element_text(family = "space",
79 | hjust = 0.5, size = 24,
80 | lineheight = 0.3,
81 | margin = margin(b = 10)),
82 | axis.title = element_blank(),
83 | axis.text = element_blank(),
84 | axis.ticks = element_blank(),
85 | plot.margin = unit(c(0.5, 0.8, 0, 0.8), "cm"))
86 | p
87 |
88 | ggsave(p, filename = "2022/images/challenge_09.jpg", height = 5, width = 4, unit = "in")
89 |
--------------------------------------------------------------------------------
/2022/challenge_02.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(ggforce)
3 | library(showtext)
4 |
5 | # load data
6 | df <- readr::read_csv("2022/data/02.csv") %>%
7 | distinct() %>%
8 | mutate(label = paste0("$", format(`Valuation (Dollars)`,big.mark=",", trim=TRUE)))
9 | df
10 |
11 | # load fonts
12 | font_add_google(name = "Space Mono", family = "space")
13 | showtext_auto()
14 |
15 | # prep data
16 | circles <- tibble(x = rep(0, 6),
17 | y = rep(0, 6),
18 | r = c(20, 19, 18, 11, 7, 6),
19 | fill = as.factor(1:6))
20 |
21 | year_labels <- tibble(x = rep(0, 6),
22 | y = -1*c(20, 19, 18, 11, 7, 6)+0.5,
23 | label = rev(df$Year),
24 | colour = c(rep("black", 5), "white"))
25 |
26 | # plot
27 | p <- ggplot() +
28 | # circles
29 | geom_circle(data = circles,
30 | mapping = aes(x0 = x, y0 = y, r = r, fill = fill),
31 | colour = "#c39c63") +
32 | # cutouts
33 | geom_arc_bar(aes(x0 = -2, y0 = 2, r0 = 16.7, r = 0, start = 5.5, end = 5.8),
34 | fill = "#c11332", colour = "#c11332") +
35 | geom_arc_bar(aes(x0 = 2, y0 = 2, r0 = 15.7, r = 0, start = 0.5, end = 0.8),
36 | fill = "#dbc8b0", colour = "#dbc8b0") +
37 | geom_arc_bar(aes(x0 = 3, y0 = 0, r0 = 13.7, r = 0, start = 1.4, end = 1.7),
38 | fill = "#efad00", colour = "#efad00") +
39 | geom_arc_bar(aes(x0 = 2, y0 = -2, r0 = 7.7, r = 0, start = 2.1, end = 2.7),
40 | fill = "#3a5288", colour = "#3a5288") +
41 | geom_arc_bar(aes(x0 = -2, y0 = -2, r0 = 3.3, r = 0, start = 3.8, end = 4.4),
42 | fill = "#b28e73", colour = "#b28e73") +
43 | # text
44 | geom_text(data = year_labels,
45 | mapping = aes(x = x, y = y, label = label, colour = I(colour)),
46 | family = "space") +
47 | geom_text(data = df,
48 | mapping = aes(x = 0, y = 0, label = unlist(df[1,3])),
49 | colour = "white", family = "space") +
50 | geom_text(data = df,
51 | aes(x = -4.6, y = -3.7, label = unlist(df[2,3])),
52 | colour = "black", family = "space", angle = 35, size = 2) +
53 | geom_text(data = df,
54 | aes(x = 5, y = -6, label = unlist(df[3,3])),
55 | colour = "white", family = "space", angle = -55) +
56 | geom_text(data = df,
57 | aes(x = 10, y = 0, label = unlist(df[4,3])),
58 | colour = "black", family = "space", angle = 0) +
59 | geom_text(data = df,
60 | aes(x = 8, y = 10, label = unlist(df[5,3])),
61 | colour = "black", family = "space", angle = 55) +
62 | geom_text(data = df,
63 | aes(x = -8, y = 10, label = unlist(df[6,3])),
64 | colour = "black", family = "space", angle = -55) +
65 | # theme
66 | scale_fill_manual(values = c("#c11332", "#dbc8b0", "#efad00",
67 | "#3a5288", "#b28e73", "#131313")) +
68 | coord_fixed() +
69 | labs(title = "ASSESSED VALUATION OF ALL TAXABLE PROPERTY\nOWNED BY GEORGIA NEGROES. ") +
70 | theme(plot.background = element_rect(fill = "#dac8b8", colour="#dac8b8"),
71 | panel.background = element_rect(fill = "#dac8b8", colour="#dac8b8"),
72 | panel.grid.major = element_blank(),
73 | panel.grid.minor = element_blank(),
74 | legend.position = "none",
75 | plot.title = element_text(family = "space", face = "bold",
76 | hjust = 0.5, size = 24,
77 | lineheight = 0.3,
78 | margin = margin(b = 30)),
79 | axis.title = element_blank(),
80 | axis.text = element_blank(),
81 | axis.ticks = element_blank(),
82 | plot.margin = unit(c(0.1, 0.8, 1.3, 0.8), "cm"))
83 | p
84 |
85 | ggsave(p, filename = "2022/images/challenge_02.jpg", height = 5, width = 4, unit = "in")
86 |
--------------------------------------------------------------------------------
/2022/challenge_07.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(showtext)
3 | library(cowplot)
4 |
5 | # load data
6 | df <- readr::read_csv("2022/data/07.csv")
7 |
8 | # load fonts
9 | font_add_google(name = "Space Mono", family = "space")
10 | font_add_google(name = "Cormorant Garamond", family = "corgar")
11 | showtext_auto()
12 |
13 | # prep data
14 | plot_data <- df %>%
15 | pivot_longer(cols = 3:5, names_to = "status", values_to = "perc") %>%
16 | mutate(new_perc = perc* c(1, -1)[(as.numeric(Gender == "Male")+1)]) %>%
17 | unite(col = "new_status", c(Gender, status), sep="-") %>%
18 | mutate(new_status_f = factor(new_status,
19 | levels = c("Male-Widowed", "Male-Married", "Male-Single",
20 | "Female-Widowed", "Female-Married", "Female-Single")))
21 | # text df
22 | text_df_left = tibble(x = c(-92, -60, -35),
23 | y = c(8.5, 5.5, 2),
24 | label = c("WIDOWED", "MARRIED", "SINGLE"))
25 |
26 | text_df_right = tibble(x = c(92, 60, 35),
27 | y = c(8.5, 5.5, 2),
28 | label = c("WIDOWED", "MARRIED", "SINGLE"))
29 |
30 | # plot
31 | p <- ggplot() +
32 | geom_col(data = plot_data, mapping = aes(x = new_perc, y = Group, fill = new_status_f), width = 1, alpha = 0.94) +
33 | geom_text(data = text_df_left, mapping = aes(x = x, y = y, label = label), family = "roboto", angle = 60, size = 6) +
34 | geom_text(data = text_df_right, mapping = aes(x = x, y = y, label = label), family = "roboto", angle = -60, size = 6) +
35 | coord_cartesian(expand = F) +
36 | scale_x_continuous(breaks = c(seq(-100, 100, 10)), labels = c(seq(100, 10, -10), "", seq(10, 100, 10))) +
37 | labs(title = "Conjugal condition of American Negroes according to age periods.",
38 | subtitle = "Condition conjugale des Negres Americains au point de vue de l'age.",
39 | x = "PER CENTS.",
40 | y = "AGES",
41 | tag = "Done by Atlanta University") +
42 | scale_fill_manual(values = c("Male-Widowed" = "#2e8059", "Male-Married"="#ca183b", "Male-Single" = "#064da1",
43 | "Female-Single" = "#064da1", "Female-Married"="#ca183b", "Female-Widowed"="#2e8059")) +
44 | theme(plot.background = element_rect(fill = "#dfd3c2", colour="#dfd3c2"),
45 | panel.background = element_rect(fill = "#dfd3c2", colour="#dfd3c2"),
46 | legend.position = "none",
47 | axis.ticks = element_blank(),
48 | panel.grid.minor = element_blank(),
49 | panel.grid.major = element_line(colour = "black"),
50 | plot.margin = unit(c(1, 1.1, 1, 0.1), "cm"),
51 | plot.title = element_text(colour = "black", size=20, face = "bold", hjust = 0.5, family="corgar",
52 | margin = margin(0, 0, 10, 0)),
53 | plot.subtitle = element_text(colour = "black", size=14, hjust = 0.5, family="corgar",
54 | margin = margin(0, 0, 30, 0)),
55 | plot.tag = element_text(colour = "black", size=12, hjust = 0.5, family="corgar"),
56 | plot.tag.position = c(0.56, 0.9),
57 | axis.text.x = element_text(colour = "black", size=14, hjust = 0.5, family="roboto"),
58 | axis.text.y = element_text(colour = "black", size=14, vjust = 0, family="roboto"),
59 | axis.title.x = element_text(colour = "black", size=14, family="roboto"),
60 | axis.title.y = element_text(colour = "black", size=14, angle = 0, hjust = 110, vjust = 0.98, family="roboto"))
61 | p
62 |
63 | # add labels
64 | q <- ggdraw() +
65 | draw_plot(p) +
66 | draw_label("MALES", x = 0.35, y = 0.80, colour = "black", size=15, fontfamily="roboto") +
67 | draw_label("FEMALES", x = 0.67, y = 0.80, colour = "black", size=15, fontfamily="roboto") +
68 | draw_label("0-15", x = 0.93, y = 0.16, colour = "black", size=14, fontfamily="roboto", hjust = 0.5) +
69 | draw_label("15-20", x = 0.93, y = 0.23, colour = "black", size=14, fontfamily="roboto", hjust = 0.5) +
70 | draw_label("20-25", x = 0.93, y = 0.305, colour = "black", size=14, fontfamily="roboto", hjust = 0.5) +
71 | draw_label("25-30", x = 0.93, y = 0.38, colour = "black", size=14, fontfamily="roboto", hjust = 0.5) +
72 | draw_label("30-35", x = 0.93, y = 0.455, colour = "black", size=14, fontfamily="roboto", hjust = 0.5) +
73 | draw_label("35-45", x = 0.93, y = 0.53, colour = "black", size=14, fontfamily="roboto", hjust = 0.5) +
74 | draw_label("45-55", x = 0.93, y = 0.60, colour = "black", size=14, fontfamily="roboto", hjust = 0.5) +
75 | draw_label("55-65", x = 0.93, y = 0.675, colour = "black", size=14, fontfamily="roboto", hjust = 0.5) +
76 | draw_label("Over 65", x = 0.93, y = 0.76, colour = "black", size=14, fontfamily="roboto", hjust = 0.5) +
77 | draw_label("AGES", x = 0.92, y = 0.775, colour = "black", size=14, fontfamily="roboto", hjust = 0.5)
78 | q
79 |
80 | ggsave(q, filename = "2022/images/challenge_07.jpg", height = 5, width = 4, unit = "in")
81 |
82 |
83 |
--------------------------------------------------------------------------------
/2022/challenge_04.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(showtext)
3 | library(scales)
4 |
5 | # load data
6 | df <- readr::read_csv("2022/data/04.csv")
7 |
8 | # load fonts
9 | font_add_google(name = "Space Mono", family = "space")
10 | showtext_auto()
11 |
12 | # prep data
13 | plot_data <- df %>%
14 | mutate(lt = as.character(1+as.numeric((Year > 1874 & Year < 1899))))
15 | df_rect <- data.frame(x1 = 1865, x2 = 1870, y1 = 0, y2 = 5000000)
16 |
17 | plot_data1 <- plot_data %>%
18 | filter(Year < 1899)
19 |
20 | plot_data2 <- plot_data %>%
21 | filter(Year >= 1899)
22 |
23 | plot_data3 <- plot_data %>%
24 | filter(Year > 1874 & Year < 1899)
25 |
26 | # plot
27 | p <- ggplot() +
28 | geom_line(data = plot_data1,
29 | mapping = aes(x = Year, y = `Property Valuation`, colour = lt), size = 2) +
30 | geom_line(data = plot_data2,
31 | mapping = aes(x = Year, y = `Property Valuation`, colour = lt), size = 2) +
32 | geom_line(data = plot_data3,
33 | mapping = aes(x = Year, y = `Property Valuation`, colour = lt), size = 0.8) +
34 | geom_line(data = plot_data,
35 | mapping = aes(x = Year, y = `Property Valuation`+20000), size = 0.1) +
36 | geom_line(data = plot_data,
37 | mapping = aes(x = Year, y = `Property Valuation`-20000), size = 0.1) +
38 | geom_rect(data=df_rect, aes(xmin=x1, xmax=x2,ymin = y1, ymax = y2),
39 | fill="#dfd3c2", size=0.5,
40 | colour = alpha("black", 0.1)) +
41 | labs(title = "VALUATION OF TOWN AND CITY PROPERTY OWNED\nBY GEORGIA NEGROES.",
42 | x = "", y = "DOLLARS") +
43 | scale_colour_manual(values = c("1" = "#dfd3c2", "2" = "black")) +
44 | coord_cartesian(expand = F) +
45 | scale_x_continuous(limits = c(1860, 1900),
46 | breaks = c(seq(1870, 1900, 5)),
47 | minor_breaks = c(seq(1870, 1900, 1))) +
48 | scale_y_continuous(limits = c(0, 5000000),
49 | breaks = c(seq(1000000, 4000000, 1000000)),
50 | minor_breaks = c(seq(0, 5000000, 100000)),
51 | labels = comma) +
52 | annotate("text", x = 1877, y = 2300000, label = "POLITICAL\n UNREST", family = "space", size = 4, lineheight = 0.4, colour = "gray20") +
53 | annotate("text", x = 1884, y = 4200000, label = "RISE OF\n THE NEW\n INDUSTRIALISM", lineheight = 0.4, family = "space", size = 4, colour = "gray20") +
54 | annotate("text", x = 1896, y = 2400000, label = "DISFRANCHSMENT\nAND\nPROSCRIPTIVE\nLAWS", family = "space", lineheight = 0.4, size = 4, colour = "gray20") +
55 | annotate("text", x = 1892, y = 1600000, label = "LYNCHING", family = "space", size = 4, colour = "gray20") +
56 | annotate("text", x = 1872, y = 300000, label = "KU-KLUXISM", angle = 90, hjust = 0, vjust = 0.5, family = "space", size = 4, colour = "gray20") +
57 | annotate("text", x = 1894, y = 300000, label = "FINANCIAL PANIC", angle = 90, hjust = 0, vjust = 0.5, family = "space", size = 4, colour = "gray20") +
58 | annotate("text", x = 1861, y = 400000, label = "$", hjust = 0, vjust = 0.5, family = "space", size = 6, colour = "gray20") +
59 | annotate("text", x = 1861, y = 600000, label = "$", hjust = 0, vjust = 0.5, family = "space", size = 6, colour = "gray20") +
60 | annotate("text", x = 1861, y = 1400000, label = "$", hjust = 0, vjust = 0.5, family = "space", size = 6, colour = "gray20") +
61 | annotate("text", x = 1861, y = 1600000, label = "$", hjust = 0, vjust = 0.5, family = "space", size = 6, colour = "gray20") +
62 | annotate("text", x = 1861, y = 2400000, label = "$", hjust = 0, vjust = 0.5, family = "space", size = 6, colour = "gray20") +
63 | annotate("text", x = 1861, y = 2600000, label = "$", hjust = 0, vjust = 0.5, family = "space", size = 6, colour = "gray20") +
64 | annotate("text", x = 1861, y = 3400000, label = "$", hjust = 0, vjust = 0.5, family = "space", size = 6, colour = "gray20") +
65 | annotate("text", x = 1861, y = 3600000, label = "$", hjust = 0, vjust = 0.5, family = "space", size = 6, colour = "gray20") +
66 | annotate("text", x = 1861, y = 4400000, label = "$", hjust = 0, vjust = 0.5, family = "space", size = 6, colour = "gray20") +
67 | annotate("text", x = 1861, y = 4600000, label = "$", hjust = 0, vjust = 0.5, family = "space", size = 6, colour = "gray20") +
68 | annotate("text", x = 1861, y = 1000000, label = "1,000, 000", hjust = 0, vjust = 0.5, family = "space", size = 4, colour = "gray20") +
69 | annotate("text", x = 1861, y = 2000000, label = "2,000, 000", hjust = 0, vjust = 0.5, family = "space", size = 4, colour = "gray20") +
70 | annotate("text", x = 1861, y = 3000000, label = "3,000, 000", hjust = 0, vjust = 0.5, family = "space", size = 4, colour = "gray20") +
71 | annotate("text", x = 1861, y = 4000000, label = "4,000, 000", hjust = 0, vjust = 0.5, family = "space", size = 4, colour = "gray20") +
72 | theme_light() +
73 | theme(plot.background = element_rect(fill = "#dfd3c2", colour="#dfd3c2"),
74 | panel.background = element_rect(fill = "#dfd3c2", colour="#dfd3c2"),
75 | legend.position = "none",
76 | axis.text.y = element_blank(),
77 | axis.text.x = element_text(colour = "black", size=12, family="space", vjust = 2),
78 | axis.ticks = element_blank(),
79 | axis.title.y = element_text(colour = "black", size=14, hjust = -65, family="space", angle = 0),
80 | plot.title = element_text(colour = "black", size=20, face = "bold", hjust = 0.5, lineheight = 0.3, family="space",
81 | margin = margin(0, 0, 10, 0)),
82 | panel.grid.major = element_line(colour = alpha("black", 0.1)),
83 | panel.grid.minor = element_line(colour = alpha("red", 0.1)),
84 | plot.margin = unit(c(0.5, 0.5, 0.2, 0.1), "cm"))
85 | p
86 |
87 | ggsave(p, filename = "2022/images/challenge_04.jpg", height = 5, width = 4, unit = "in")
88 |
89 |
90 |
--------------------------------------------------------------------------------
/2021/challenge_10.R:
--------------------------------------------------------------------------------
1 | library(extrafont)
2 | library(ggpubr)
3 | library(maps)
4 | library(ggmap)
5 | library(rgdal)
6 |
7 | dev.new(width=5,height=6.25,unit="in", noRStudioGD = TRUE)
8 |
9 | states <- map_data("state")
10 | georgia <- subset(states, region %in% c("georgia"))
11 | #historic shapefiles obtained from https://publications.newberry.org/ahcbp/pages/Georgia.html
12 | ga = readOGR(dsn=".", layer="GA_Historical_Counties", stringsAsFactors = FALSE)
13 | ga$start_year <- substr(ga$START_DATE, 1, 4)
14 | ga$end_year <- substr(ga$END_DATE, 1, 4)
15 | ga@data$id = rownames(ga@data)
16 | ga.points = fortify(ga, region="id")
17 | ga.df = inner_join(ga.points, ga@data, by="id")
18 | gaYear <- function(df, year) {
19 | temp2 <- subset(df, end_year > year & start_year < year+1)
20 | }
21 | ga1890 <- usYear(ga.df, 1890)
22 |
23 | #manually add in colour data
24 | county_names <- unique(ga1890$NAME)
25 | county_values <- c("red", "red", "lightpink","tan4","red",
26 | "tan4", "red","black","gold2","lightpink",
27 | "olivedrab4","olivedrab4","lightpink","red","gold2",
28 | "lightpink","red","lightpink","lightpink","red",
29 | "antiquewhite3","red","red","red","red",
30 | "lightpink","olivedrab4","olivedrab4","lightpink","lightpink",
31 | "gold2","red","red","red","lightpink","gold2",
32 | "red","gold2","red","red","olivedrab4",
33 | "lightpink","red","tan4","gold2","olivedrab4",
34 | "black","lightpink","red","lightpink","antiquewhite3",
35 | "olivedrab4","gold2","antiquewhite3","red","red",
36 | "red","lightpink","gold2","gold2","antiquewhite3",
37 | "lightpink","antiquewhite3","red","red","lightpink",
38 | "antiquewhite3","lightpink","gold2","antiquewhite3","gold2",
39 | "red","gold2","red","gold2","lightpink",
40 | "gold2","olivedrab4","lightpink","lightpink","antiquewhite3",
41 | "lightpink","gold2","red","red","red",
42 | "antiquewhite3","antiquewhite3","antiquewhite3","red","antiquewhite3",
43 | "gold2","gold2","black","gold2","gold2",
44 | "red","red","antiquewhite3","black","lightpink",
45 | "red","lightpink","gold2","red","antiquewhite3",
46 | "lightpink","lightpink","red","olivedrab4","blue4",
47 | "red","red","lightpink","olivedrab4","antiquewhite3",
48 | "lightpink","lightpink","gold2","lightpink","gold2",
49 | "antiquewhite3", "red", "olivedrab4","gold2","lightpink",
50 | "lightpink","lightpink","antiquewhite3","antiquewhite3","red",
51 | "gold2","olivedrab4","olivedrab4","olivedrab4", "white", "red")
52 | county <- data.frame(NAME=county_names, county_values)
53 | ga1890_col <- inner_join(ga1890, county, by = "NAME")
54 | p10 <- ggplot() +
55 | geom_polygon(data=georgia, aes(x=long, y=lat, group=group), color="black", size=0.3, fill="lightblue") +
56 | geom_polygon(aes(x=long,y=lat,group=group, fill=county_values), size = 0.3, color=alpha("black",0.5), data = ga1890_col) +
57 | labs(title="\n\nNEGRO POPULATION OF GEORGIA BY COUNTIES.", subtitle="1890.\n\n\n\n") +
58 | annotate("text", x = -87, y = 29, label = "OVER 30,000 NEGROES\n\n\nBETWEEN 20,000 AND 30,000\n\n\n15,000 TO 20,000\n\n\n10,000 TO 15,000", colour = alpha("black",0.5), size=2.5, hjust = 0, family="Lucida Sans Typewriter") +
59 | annotate("text", x = -80.5, y = 29, label = "5,000 TO 10,000\n\n\n2,500 TO 5,000\n\n\n1,000 TO 2,500\n\n\nUNDER 1000", colour = alpha("black",0.5), size=2.5, hjust = 1, family="Lucida Sans Typewriter") +
60 | annotate("point", x = -83, y = 30.05, colour = "black", fill="red", size=7, pch=21) +
61 | annotate("point", x = -83, y = 29.35, colour = "black", fill="lightpink", size=7, pch=21) +
62 | annotate("point", x = -83, y = 28.6, colour = "black", fill="gold2", size=7, pch=21) +
63 | annotate("point", x = -83, y = 27.9, colour = "black", fill="olivedrab4", size=7, pch=21) +
64 | annotate("point", x = -87.5, y = 30.05, colour = "black", fill="black", size=7, pch=21) +
65 | annotate("point", x = -87.5, y = 29.35, colour = "black", fill="blue4", size=7, pch=21) +
66 | annotate("point", x = -87.5, y = 28.6, colour = "black", fill="tan4", size=7, pch=21) +
67 | annotate("point", x = -87.5, y = 27.9, colour = "black", fill="antiquewhite3", size=7, pch=21) +
68 | scale_fill_manual("", values = c("red"="red", "lightpink"="lightpink", "gold2"="gold2", "olivedrab4"="olivedrab4",
69 | "black"="black", "blue4"="blue4", "tan4"="tan4", "antiquewhite3"="antiquewhite3","purple"="purple", "white" = "white")) +
70 | coord_cartesian(clip = 'off') +
71 | theme(panel.background = element_rect(fill = "antiquewhite2", color = NA),
72 | plot.background = element_rect(fill = "antiquewhite2"),
73 | legend.background = element_rect(fill = "antiquewhite2"),
74 | plot.title = element_text(colour = "black", size=12, hjust = 0.5, face="bold", family="Lucida Sans Typewriter"),
75 | plot.subtitle = element_text(colour = "black", size=10, hjust = 0.5, face="bold", family="Lucida Sans Typewriter"),
76 | legend.title = element_blank(),
77 | legend.position="none",
78 | legend.justification=c(0.5,0),
79 | plot.margin = unit(c(0.2, 2, 1, 2), "cm"), #top, right, bottom, left
80 | legend.key = element_rect(fill = "antiquewhite2"),
81 | legend.spacing.x = unit(0.1,"cm"),
82 | legend.text = element_text(colour=alpha("black",0.5), size=6, family="Lucida Sans Typewriter", margin = margin(r = 100, unit = "pt")),
83 | axis.title.x= element_blank(),
84 | axis.title.y= element_blank(),
85 | axis.ticks = element_blank(),
86 | axis.text.x=element_blank(),
87 | axis.text.y=element_blank(),
88 | panel.grid.minor = element_blank(),
89 | panel.grid.major = element_blank()
90 | )
91 | p10
92 |
93 | ggsave(p10, filename = "2021/images/challenge_10.jpg", height=6.25, width=5, unit="in")
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/2021/challenge_03.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(extrafont)
3 | library(ggpubr)
4 | library(cowplot)
5 | tuesdata <- tidytuesdayR::tt_load('2021-02-16')
6 | occupation <- tuesdata$occupation
7 |
8 | dev.new(width=5,height=6.25,unit="in", noRStudioGD = TRUE)
9 |
10 |
11 | d1 <- data.frame(rbind(filter(occupation, Group=="Negroes"), c("Negroes", "Dummy_var1",2*sum(filter(occupation, Group=="Negroes")$Percentage))))
12 | d1$Perc <- as.numeric(d1$Percentage)/sum(as.numeric(d1$Percentage))
13 | d1$occup <- factor(d1$Occupation, levels = c("Professions","Trade and Transportation", "Manufacturing and Mechanical Industries", "Domestic and Personal Service", "Agriculture, Fisheries and Mining", "Dummy_var_1"))
14 |
15 | k <- rbind(c("Whites", "Dummy_var1",(1.5)*sum(filter(occupation, Group=="Whites")$Percentage)), c("Whites", "Dummy_var2",(0.5)*sum(filter(occupation, Group=="Whites")$Percentage)))
16 | colnames(k) <- c("Group", "Occupation", "Percentage")
17 | d2 <- data.frame(rbind(filter(occupation, Group=="Whites"), k))
18 | d2$Perc <- as.numeric(d2$Percentage)/sum(as.numeric(d2$Percentage))
19 | d2$occup <- factor(d2$Occupation, levels = c("Dummy_var1", "Professions","Trade and Transportation", "Manufacturing and Mechanical Industries", "Domestic and Personal Service", "Agriculture, Fisheries and Mining","Dummy_var2"))
20 |
21 | p03 <- ggplot() +
22 | geom_bar(data=d1, aes(x="", y=Perc, fill=occup), width = 1, stat = "identity") +
23 | geom_bar(data=d2, aes(x="", y=Perc, fill=occup), width = 1, stat = "identity") +
24 | scale_fill_manual("", values=c("Agriculture, Fisheries and Mining" = "red3", "Manufacturing and Mechanical Industries" = alpha("dodgerblue3",0.8), "Domestic and Personal Service" = "gold1", "Professions" = alpha("darkgoldenrod4",0.7), "Trade and Transportation" = "cornsilk1", "Dummy_var_1"="white", "Dummy_var_2"="white")) +
25 | coord_polar("y", start=45, clip = 'off') +
26 | labs(title="\nOCCUPATIONS OF NEGROES AND WHITES IN GEORGIA") +
27 | theme(panel.background = element_rect(fill = "seashell2"),
28 | plot.background = element_rect(fill = "seashell2"),
29 | legend.background = element_rect(fill = "seashell2"),
30 | plot.title = element_text(colour = "black", size=11, hjust = 0.5, family="Lucida Sans Typewriter"),
31 | legend.title = element_blank(),
32 | legend.position="none",
33 | legend.justification=c(0.5,0),
34 | plot.margin = unit(c(0.2, 0, 2, 0), "cm"), #top, right, bottom, left
35 | legend.key = element_rect(fill = "seashell2"),
36 | legend.spacing.x = unit(0.1,"cm"),
37 | legend.text = element_text(colour=alpha("black",0.5), size=6, family="Lucida Sans Typewriter", margin = margin(r = 100, unit = "pt")),
38 | axis.title.x= element_blank(),
39 | axis.title.y= element_blank(),
40 | axis.ticks = element_blank(),
41 | axis.text.x=element_blank(),
42 | axis.text.y=element_blank(),
43 | panel.grid.minor = element_blank(),
44 | panel.grid.major = element_blank()
45 | )
46 |
47 |
48 | p03
49 |
50 | g1 <- grid::circleGrob(gp = grid::gpar(fill = "red3"))
51 | g2 <- grid::circleGrob(gp = grid::gpar(fill = alpha("dodgerblue3",0.8)))
52 | g3 <- grid::circleGrob(gp = grid::gpar(fill = "gold1"))
53 | g4 <- grid::circleGrob(gp = grid::gpar(fill = alpha("darkgoldenrod4",0.7)))
54 | g5 <- grid::circleGrob(gp = grid::gpar(fill = "cornsilk1"))
55 |
56 |
57 | ggdraw(p03) +
58 | draw_label("WHITES", x = 0.5, y = 0.19, hjust = 0.5, vjust = 0, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 8) +
59 | draw_label("NEGROES", x = 0.5, y = 0.85, hjust = 0.5, vjust = 0, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 8) +
60 | draw_label("AGRICULTURE, FISHERIES\n AND MINING", x = 0.29, y = 0.55, hjust = 0.5, vjust = 0, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
61 | draw_label("MANUFACTURING AND\nMECHANICAL INDUSTRIES", x = 0.2, y = 0.49, hjust = 0, vjust = 0, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
62 | draw_label("DOMESTIC AND\nPERSONAL SERVICE", x = 0.75, y = 0.59, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
63 | draw_label("PROFESSIONS", x = 0.77, y = 0.53, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
64 | draw_label("TRADE AND\nTRANSPORTATION", x = 0.76, y = 0.47, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
65 | draw_label("62%", x = 0.4, y = 0.75, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 7) +
66 | draw_label("5%", x = 0.79, y = 0.73, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 7) +
67 | draw_label("28%", x = 0.68, y = 0.78, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
68 | draw_label("0.8%", x = 0.82, y = 0.69, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 2) +
69 | draw_label("4.5%", x = 0.81, y = 0.70, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
70 | draw_label("64%", x = 0.6, y = 0.3, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 7) +
71 | draw_label("12.5%", x = 0.32, y = 0.28, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
72 | draw_label("5.5%", x = 0.38, y = 0.25, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
73 | draw_label("4%", x = 0.19, y = 0.36, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
74 | draw_label("13%", x = 0.24, y = 0.32, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.5), size = 5) +
75 | draw_grob(g1, x=-0.34, y=0.06, scale = 0.04) +
76 | draw_grob(g2, x=-0.34, y=-0.0, scale = 0.04) +
77 | draw_grob(g3, x=0.35, y=0.09, scale = 0.04) +
78 | draw_grob(g4, x=0.35, y=0.03, scale = 0.04) +
79 | draw_grob(g5, x=0.35, y=-0.03, scale = 0.04)
80 |
81 |
82 |
--------------------------------------------------------------------------------
/2022/challenge_01.R:
--------------------------------------------------------------------------------
1 | library(showtext)
2 | library(ggplot2)
3 | library(gridExtra)
4 | library(rnaturalearth)
5 | library(rnaturalearthdata)
6 | library(sf)
7 | library(ggforce)
8 | library(cowplot)
9 | library(rnaturalearthhires)
10 |
11 | `%notin%` <- Negate(`%in%`)
12 |
13 | # load fonts
14 | font_add_google(name = "Space Mono", family = "space")
15 | showtext_auto()
16 |
17 | # data
18 | world <- ne_countries(scale = "small", returnclass = "sf")
19 |
20 | usa <- ne_states(iso_a2 = 'us', returnclass = "sf")
21 | brazil <- ne_states(country = 'brazil', returnclass = "sf")
22 | amer <- world[world$region_un %in% c("Americas"),]
23 | country_col1 <- rep("tan", length(amer$name))
24 | amer$country_col1 <- country_col1
25 | usa_col <- rep("tan", length(usa$name))
26 | usa_col[which(usa$name %in% c("Florida", "Georgia", "Alabama", "Mississippi", "South Carolina"))] <- "black"
27 | usa_col[which(usa$name %in% c("Tennessee", "North Carolina", "Arkansas", "Louisiana"))] <- "chocolate4"
28 |
29 | brazil_col <- rep("tan", length(brazil$name))
30 | brazil_col[which(brazil$name %in% c("Ceará", "Bahia", "Paraíba", "Piauí", "Rio Grande do Norte",
31 | "Pernambuco", "Sergipe", "Alagoas", "Minas Gerais", "Espírito Santo", "Rio de Janeiro"))] <- "black"
32 | brazil_col[which(brazil$name %in% c("Maranhão", "Tocantins", "Goiás", "São Paulo", "Rio de Janeiro", "Distrito Federal"))] <- "chocolate4"
33 |
34 |
35 |
36 |
37 | p1 <- ggplot() +
38 | geom_circle(aes(x0 = 1821000, y0 =3910000, r = 8160900), colour="black", fill="#bda086") +
39 | geom_sf(data = amer, fill=country_col1) +
40 | geom_sf(data = brazil, fill=brazil_col) +
41 | geom_sf(data = usa, fill=usa_col) +
42 | geom_point(data=data.frame(x = 2121000, y =5580000), aes(x=x, y=y), pch=19, size=1, col="white") +
43 | coord_sf(crs = "+proj=laea +lat_0=10 +lon_0=-60 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs ",
44 | xlim=c(-2339981, 12803058)-3400000, ylim=c(-5095286, 9970916)+1500000) +
45 | theme(panel.background = element_rect(fill = "#d0bba8", colour = "#d0bba8"),
46 | plot.background = element_rect(fill = "#d0bba8", colour = "#d0bba8"),
47 | legend.background = element_rect(fill = "#d0bba8", colour = "#d0bba8"),
48 | plot.title = element_text(colour = "black", size=12, face="bold", hjust = 0.5, family="space"),
49 | plot.subtitle = element_text(colour = "black", size=10, face="bold", hjust = 0.5, family="space"),
50 | legend.title = element_blank(),
51 | legend.position="none",
52 | plot.margin = unit(c(6, 0, 6, 0), "cm"), #top, right, bottom, left
53 | legend.key = element_rect(colour = "black"),
54 | legend.spacing.x = unit(0.5,"cm"),
55 | legend.text = element_text(colour="black", size=9),
56 | axis.title.x= element_blank(),
57 | axis.title.y= element_blank(),
58 | axis.text.x=element_blank(),
59 | axis.text.y=element_blank(),
60 | axis.ticks.x=element_blank(),
61 | axis.ticks.y=element_blank(),
62 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
63 | )
64 |
65 | p1
66 |
67 |
68 | afr_eur <- world[world$name %notin% c("Indonesia", "Australia", "Canada",
69 | "Greenland", "United States", "Cuba",
70 | "Papua New Guinea", "Fr. S. Antarctic Lands") & world$region_un %notin% c("Americas", "Antarctica"),]
71 | country_col2 <- rep("tan", length(afr_eur$name))
72 | country_col2[which(afr_eur$region_un == "Africa")] <- "black"
73 | country_col2[which(afr_eur$name == "Lesotho")] <- "chocolate4"
74 | country_col2[which(afr_eur$name == "Madagascar")] <- "tan"
75 | country_col2[which(afr_eur$name %in% c("South Africa", "Algeria", "Tunisia", "Libya",
76 | "Egypt", "Morocco", "Western Sahara", "W. Sahara", "Mauritania",
77 | "Mali", "Niger", "Chad", "Sudan"))] <- "chocolate4"
78 | afr_eur$country_col2 <- country_col2
79 | p2 <- ggplot() +
80 | geom_circle(aes(x0 = 5221000, y0 =2510000, r = 8160900), colour="black", fill="#bda086") +
81 | geom_sf(data = afr_eur, fill=country_col2) +
82 | coord_sf(crs = "+proj=laea +lat_0=40 +lon_0=45 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs ",
83 | xlim=c(-2339981, 12803058), ylim=c(-5095286, 9970916)) +
84 | theme(panel.background = element_rect(fill = "#d0bba8", colour = "#d0bba8"),
85 | plot.background = element_rect(fill = "#d0bba8", colour = "#d0bba8"),
86 | legend.background = element_rect(fill = "#d0bba8", colour = "#d0bba8"),
87 | plot.title = element_text(colour = "black", size=12, face="bold", hjust = 0.5, family="space"),
88 | plot.subtitle = element_text(colour = "black", size=10, face="bold", hjust = 0.5, family="space"),
89 | legend.title = element_blank(),
90 | legend.position="none",
91 | plot.margin = unit(c(6, 0, 6, 0), "cm"), #top, right, bottom, left
92 | legend.key = element_rect(colour = "black"),
93 | legend.spacing.x = unit(0.5,"cm"),
94 | legend.text = element_text(colour="black", size=9),
95 | axis.title.x= element_blank(),
96 | axis.title.y= element_blank(),
97 | axis.text.x=element_blank(),
98 | axis.text.y=element_blank(),
99 | axis.ticks.x=element_blank(),
100 | axis.ticks.y=element_blank(),
101 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
102 | )
103 |
104 | p2
105 |
106 |
107 | p <- grid.arrange(p1, p2, nrow = 1, ncol=2)
108 | p
109 |
110 | g1 <- grid::circleGrob(gp = grid::gpar(fill = "white"))
111 |
112 | q <- ggdraw(p) +
113 | theme(plot.background = element_rect(fill="#d0bba8", color = "#d0bba8")) +
114 | draw_grob(g1, x=-0.25, y=-0.285, scale = 0.015) +
115 | draw_label("THE GEORGIA NEGRO .", x = 0.5, y = 0.92, hjust = 0.5, vjust = 0.5,
116 | fontfamily = "space", fontface="bold", color = alpha("black",0.9), size = 11) +
117 | draw_label("A SOCIAL STUDY\nBY\nW.E.BURGHARDT DU BOIS.", x = 0.5, y = 0.86, hjust = 0.5, vjust = 0.5,
118 | fontfamily = "space", color = alpha("black",0.9), size = 9) +
119 | draw_label("ROUTES OF THE AFRICAN SLAVE TRADE", x = 0.3, y = 0.25, hjust = 0, vjust = 0.5,
120 | fontfamily = "space", color = alpha("black",0.7), size = 9) +
121 | draw_label("__", x = 0.24, y = 0.26, hjust = 0, vjust = 0.5,
122 | fontfamily = "space", color = alpha("black",0.7), size = 9) +
123 | draw_label("THE STATE OF GEORGIA", x = 0.3, y = 0.22, hjust = 0, vjust = 0.5,
124 | fontfamily = "space", color = alpha("black",0.7), size = 9) +
125 | draw_label("THIS CASE IS DEVOTED TO A SERIES OF CHARTS., MAPS AND OTHER DEVI-\nCES DESIGNED TO ILLUSTRATE THE DEVELOPMENT OF THE AMERICAN NEGRO IN A\nSINGLE TYPICAL STATE OF THE UNITED STATES.\n\nTHE PROBLEM OF THE 20TH CENTURY IS THE PROBLEM OF THE\nCOLOR LINE.",
126 | x = 0.5, y = 0.1, hjust = 0.5, vjust = 0.5, fontfamily = "space", color = alpha("black",0.7), size = 9) +
127 | draw_line(x=c(0.39, 0.62), y=c(0.43, 0.38), colour="black", size=0.5) +
128 | draw_line(x=c(0.26, 0.62), y=c(0.53, 0.45), colour="black", size=0.5) +
129 | draw_line(x=c(0.27, 0.62), y=c(0.51, 0.45), colour="black", size=0.5) +
130 | draw_line(x=c(0.27, 0.62), y=c(0.54, 0.45), colour="black", size=0.5)
131 |
132 | q
133 |
134 | ggsave(q, filename = "2022/images/challenge_01.jpg", height = 750, width = 600, unit = "px")
135 |
136 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/2021/challenge_08.R:
--------------------------------------------------------------------------------
1 | library(extrafont)
2 | library(ggplot2)
3 | library(gridExtra)
4 | library(rnaturalearth)
5 | library(rnaturalearthdata)
6 | library(sf)
7 | library(ggforce)
8 | library(cowplot)
9 | #dev.new(width=6,height=8,unit="in", noRStudioGD = TRUE)
10 | `%notin%` <- Negate(`%in%`)
11 |
12 | library(devtools)
13 | install.packages("rnaturalearthhires", repos = "http://packages.ropensci.org", type = "source")
14 | library(rnaturalearthhires)
15 |
16 |
17 | world <- ne_countries(scale = "small", returnclass = "sf")
18 |
19 | usa <- ne_states(iso_a2 = 'us', returnclass = "sf")
20 | brazil <- ne_states(country = 'brazil', returnclass = "sf")
21 |
22 | amer <- world[world$region_un %in% c("Americas"),]
23 | country_col1 <- rep("tan", length(amer$name))
24 | amer$country_col1 <- country_col1
25 | usa_col <- rep("tan", length(usa$name))
26 | usa_col[which(usa$name %in% c("Florida", "Georgia", "Alabama", "Mississippi", "South Carolina"))] <- "black"
27 | usa_col[which(usa$name %in% c("Tennessee", "North Carolina", "Arkansas", "Louisiana"))] <- "chocolate4"
28 |
29 | brazil_col <- rep("tan", length(brazil$name))
30 | brazil_col[which(brazil$name %in% c("Ceará", "Bahia", "Paraíba", "Piauí", "Rio Grande do Norte",
31 | "Pernambuco", "Sergipe", "Alagoas", "Minas Gerais", "Espírito Santo", "Rio de Janeiro"))] <- "black"
32 | brazil_col[which(brazil$name %in% c("Maranhão", "Tocantins", "Goiás", "São Paulo", "Rio de Janeiro", "Distrito Federal"))] <- "chocolate4"
33 |
34 |
35 |
36 |
37 | p1 <- ggplot() +
38 | geom_circle(aes(x0 = 1821000, y0 =3910000, r = 8160900), colour="black", fill="#bda086") +
39 | geom_sf(data = amer, fill=country_col1) +
40 | geom_sf(data = brazil, fill=brazil_col) +
41 | geom_sf(data = usa, fill=usa_col) +
42 | geom_point(data=data.frame(x = 2121000, y =5580000), aes(x=x, y=y), pch=19, size=1, col="white") +
43 | coord_sf(crs = "+proj=laea +lat_0=10 +lon_0=-60 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs ",
44 | xlim=c(-2339981, 12803058)-3400000, ylim=c(-5095286, 9970916)+1500000) +
45 | theme(panel.background = element_rect(fill = "#d0bba8"),
46 | plot.background = element_rect(fill = "#d0bba8"),
47 | legend.background = element_rect(fill = "#d0bba8"),
48 | plot.title = element_text(colour = "black", size=12, face="bold", hjust = 0.5, family="Lucida Sans Typewriter"),
49 | plot.subtitle = element_text(colour = "black", size=10, face="bold", hjust = 0.5, family="Lucida Sans Typewriter"),
50 | legend.title = element_blank(),
51 | legend.position="none",
52 | plot.margin = unit(c(6, 0, 6, 0), "cm"), #top, right, bottom, left
53 | legend.key = element_rect(colour = "black"),
54 | legend.spacing.x = unit(0.5,"cm"),
55 | legend.text = element_text(colour="black", size=9),
56 | axis.title.x= element_blank(),
57 | axis.title.y= element_blank(),
58 | axis.text.x=element_blank(),
59 | axis.text.y=element_blank(),
60 | axis.ticks.x=element_blank(),
61 | axis.ticks.y=element_blank(),
62 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
63 | )
64 |
65 | p1
66 |
67 |
68 | afr_eur <- world[world$name %notin% c("Indonesia", "Australia", "Canada",
69 | "Greenland", "United States", "Cuba",
70 | "Papua New Guinea", "Fr. S. Antarctic Lands") & world$region_un %notin% c("Americas", "Antarctica"),]
71 | country_col2 <- rep("tan", length(afr_eur$name))
72 | country_col2[which(afr_eur$region_un == "Africa")] <- "black"
73 | country_col2[which(afr_eur$name == "Lesotho")] <- "chocolate4"
74 | country_col2[which(afr_eur$name == "Madagascar")] <- "tan"
75 | country_col2[which(afr_eur$name %in% c("South Africa", "Algeria", "Tunisia", "Libya",
76 | "Egypt", "Morocco", "Western Sahara", "W. Sahara", "Mauritania",
77 | "Mali", "Niger", "Chad", "Sudan"))] <- "chocolate4"
78 | afr_eur$country_col2 <- country_col2
79 | p2 <- ggplot() +
80 | geom_circle(aes(x0 = 5221000, y0 =2510000, r = 8160900), colour="black", fill="#bda086") +
81 | geom_sf(data = afr_eur, fill=country_col2) +
82 | coord_sf(crs = "+proj=laea +lat_0=40 +lon_0=45 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs ",
83 | xlim=c(-2339981, 12803058), ylim=c(-5095286, 9970916)) +
84 | theme(panel.background = element_rect(fill = "#d0bba8"),
85 | plot.background = element_rect(fill = "#d0bba8"),
86 | legend.background = element_rect(fill = "#d0bba8"),
87 | plot.title = element_text(colour = "black", size=12, face="bold", hjust = 0.5, family="Lucida Sans Typewriter"),
88 | plot.subtitle = element_text(colour = "black", size=10, face="bold", hjust = 0.5, family="Lucida Sans Typewriter"),
89 | legend.title = element_blank(),
90 | legend.position="none",
91 | plot.margin = unit(c(6, 0, 6, 0), "cm"), #top, right, bottom, left
92 | legend.key = element_rect(colour = "black"),
93 | legend.spacing.x = unit(0.5,"cm"),
94 | legend.text = element_text(colour="black", size=9),
95 | axis.title.x= element_blank(),
96 | axis.title.y= element_blank(),
97 | axis.text.x=element_blank(),
98 | axis.text.y=element_blank(),
99 | axis.ticks.x=element_blank(),
100 | axis.ticks.y=element_blank(),
101 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
102 | )
103 |
104 | p2
105 |
106 |
107 | p <- grid.arrange(p1, p2, nrow = 1, ncol=2)
108 | p
109 |
110 | g1 <- grid::circleGrob(gp = grid::gpar(fill = "white"))
111 |
112 | ggdraw(p) +
113 | theme(plot.background = element_rect(fill="#d0bba8", color = "#d0bba8")) +
114 | draw_grob(g1, x=-0.25, y=-0.285, scale = 0.015) +
115 | draw_label("THE GEORGIA NEGRO .", x = 0.5, y = 0.92, hjust = 0.5, vjust = 0.5,
116 | fontfamily = "Lucida Sans Typewriter", fontface="bold", color = alpha("black",0.9), size = 11) +
117 | draw_label("A SOCIAL STUDY\nBY\nW.E.BURGHARDT DU BOIS.", x = 0.5, y = 0.86, hjust = 0.5, vjust = 0.5,
118 | fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.9), size = 9) +
119 | draw_label("ROUTES OF THE AFRICAN SLAVE TRADE", x = 0.3, y = 0.25, hjust = 0, vjust = 0.5,
120 | fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.7), size = 9) +
121 | draw_label("__", x = 0.24, y = 0.26, hjust = 0, vjust = 0.5,
122 | fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.7), size = 9) +
123 | draw_label("THE STATE OF GEORGIA", x = 0.3, y = 0.22, hjust = 0, vjust = 0.5,
124 | fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.7), size = 9) +
125 | draw_label("THIS CASE IS DEVOTED TO A SERIES OF CHARTS., MAPS AND OTHER DEVI-\nCES DESIGNED TO ILLUSTRATE THE DEVELOPMENT OF THE AMERICAN NEGRO IN A\nSINGLE TYPICAL STATE OF THE UNITED STATES.\n\nTHE PROBLEM OF THE 20TH CENTURY IS THE PROBLEM OF THE\nCOLOR LINE.",
126 | x = 0.5, y = 0.1, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.7), size = 9) +
127 | draw_line(x=c(0.39, 0.62), y=c(0.43, 0.38), colour="black", size=0.5) +
128 | draw_line(x=c(0.26, 0.62), y=c(0.53, 0.45), colour="black", size=0.5) +
129 | draw_line(x=c(0.27, 0.62), y=c(0.51, 0.45), colour="black", size=0.5) +
130 | draw_line(x=c(0.27, 0.62), y=c(0.54, 0.45), colour="black", size=0.5)
131 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------
/2021/challenge_09.R:
--------------------------------------------------------------------------------
1 | library(extrafont)
2 | library(maps)
3 | library(ggmap)
4 | library(rgdal)
5 | library(dplyr)
6 | library(cowplot)
7 | library(datasets)
8 |
9 | setwd("2021/data")
10 | birthplace <- read.csv("birthplace.csv")
11 | present <- read.csv("present.csv")
12 |
13 | setwd("./us_states")
14 | #get historic shape files from https://publications.newberry.org/ahcbp/downloads/united_states.html
15 | us = readOGR(dsn=".", layer="US_HistStateTerr", stringsAsFactors = FALSE)
16 | us$start_year <- substr(us$START_DATE, 1, 4)
17 | us$end_year <- substr(us$END_DATE, 1, 4)
18 | us@data$id = rownames(us@data)
19 | us.points = fortify(us, region="id")
20 | us.df = inner_join(us.points, us@data, by="id")
21 | usYear <- function(df, year) {
22 | temp2 <- subset(df, end_year > year & start_year < year+1)
23 | }
24 | us1890 <- usYear(us.df, 1890)
25 | us1890_2 <- us1890[which(us1890$NAME != "Alaska District"),]
26 |
27 | state_names <- unique(us1890_2$NAME)
28 | state_values <- c("red","medgray","olive","pink","medgray",
29 | "pink","lightgray","lightgray","medgray","pink",
30 | "blue","medgray","yellow","red","red",
31 | "lightgray","blue","brown","blue","brown",
32 | "lightgray","yellow","red","brown","olive",
33 | "pink","lightgray","blue","brown","yellow",
34 | "yellow","blue","lightgray","yellow","black",
35 | "lightgray","blue","yellow","pink","olive",
36 | "pink","olive","lightgray","pink","medgray",
37 | "yellow","yellow","brown","pink","blue")
38 |
39 | state <- data.frame(NAME=state_names, state_values, abbrevs)
40 | us1890_col <- inner_join(us1890_2, state, by = "NAME")
41 |
42 | #read in coord data
43 | # coord <- read.csv("present_coords.txt", row.names=NULL, fill = TRUE , header = FALSE)
44 | # present$lat <- as.numeric(coord[,1])
45 | # present$lon <- as.numeric(coord[,2])
46 | # present <- present[-which(present$State == "AK"),]
47 |
48 | p1 <- ggplot() +
49 | geom_polygon(data = us1890_col, aes(x=long,y=lat,group=group, fill=state_values), size = 0.5, color="black") +
50 | scale_fill_manual("", values = c("red"="red", "pink"="lightpink", "yellow"="gold2", "lightgray"="grey88","medgray"="grey56", "olive"="olivedrab4",
51 | "black"="black", "blue"="dodgerblue2", "brown"="tan4", "antiquewhite3"="antiquewhite3","white" = "white")) +
52 | coord_cartesian(clip = 'off') +
53 | labs(title="\n\n", caption = "PRESENT DWELLING PLACE OF NEGROES BORN IN GEORGIA") +
54 | theme_nothing() +
55 | geom_text(data=present, aes(x=lon, y=lat, label=Present.Location), family="Lucida Sans Typewriter", size=2) +
56 | geom_text(data=filter(present, State=="GA"), aes(x=lon, y=lat, label=Present.Location), family="Lucida Sans Typewriter", colour="white", size=2) +
57 | theme(panel.background = element_rect(fill = "wheat", colour = "wheat"),
58 | plot.background = element_rect(fill = "wheat", colour = "wheat"),
59 | legend.background = element_rect(fill = "wheat"),
60 | plot.title = element_text(colour = "black", size=12, hjust = 0.5, face="bold", family="Lucida Sans Typewriter"),
61 | plot.subtitle = element_text(colour = "black", size=10, hjust = 0.5, face="bold", family="Lucida Sans Typewriter"),
62 | plot.caption = element_text(colour = "black", size=8, hjust = 0.5, family="Lucida Sans Typewriter"),
63 | legend.title = element_blank(),
64 | legend.position="none",
65 | legend.justification=c(0.5,0),
66 | plot.margin = unit(c(1.5, 1.5, 0.5, 2), "cm"), #top, right, bottom, left
67 | legend.key = element_rect(fill = "wheat"),
68 | legend.spacing.x = unit(0.1,"cm"),
69 | legend.text = element_text(colour=alpha("black",0.5), size=6, family="Lucida Sans Typewriter", margin = margin(r = 100, unit = "pt")),
70 | axis.title.x= element_blank(),
71 | axis.title.y= element_blank(),
72 | axis.ticks = element_blank(),
73 | axis.text.x=element_blank(),
74 | axis.text.y=element_blank(),
75 | panel.grid.minor = element_blank(),
76 | panel.grid.major = element_blank()
77 | )
78 |
79 |
80 | #####################################################################################################################################
81 | #####################################################################################################################################
82 | state_names2 <- unique(us1890_2$NAME)
83 | state_values2 <- c("lightgray","blue","red","brown","lightgray",
84 | "medgray","blue","medgray","pink","olive",
85 | "yellow","pink","red","lightgray","blue",
86 | "red","red","blue","medgray","olive",
87 | "yellow","pink","lightgray","blue","pink",
88 | "lightgray","brown","blue","medgray","brown",
89 | "olive","red","red","lightgray","black",
90 | "olive","yellow","red","brown","pink",
91 | "brown","olive","yellow","medgray","red",
92 | "olive","lightgray","lightgray","yellow","pink")
93 | state2 <- data.frame(NAME=state_names2, state_values2)
94 | us1890_col2 <- inner_join(us1890_2, state2, by = "NAME")
95 |
96 | #read in coord data
97 | # coord <- read.csv("birthplace_coords.txt", row.names=NULL, fill = TRUE , header = FALSE)
98 | # birthplace$lat <- as.numeric(coord[,1])
99 | # birthplace$lon <- as.numeric(coord[,2])
100 | # birthplace <- birthplace[-which(birthplace$State == "AK"),]
101 |
102 | p2 <- ggplot() +
103 | geom_polygon(data = us1890_col2, aes(x=long,y=lat,group=group, fill=state_values2), size = 0.5, color="black") +
104 | scale_fill_manual("", values = c("red"="red", "pink"="lightpink", "yellow"="gold2", "lightgray"="grey88","medgray"="grey56", "olive"="olivedrab4",
105 | "black"="black", "blue"="dodgerblue2", "brown"="tan4", "antiquewhite3"="antiquewhite3","white" = "white")) +
106 | coord_cartesian(clip = 'off') +
107 | theme_nothing() +
108 | geom_text(data=birthplace, aes(x=lon, y=lat, label=Birthplace), family="Lucida Sans Typewriter", size=2) +
109 | geom_text(data=filter(birthplace, State=="GA"), aes(x=lon, y=lat, label=Birthplace), family="Lucida Sans Typewriter", colour="white", size=2) +
110 | labs(title="", caption = "BIRTH PLACE OF NEGROES NOW IN GEORGIA") +
111 | theme(panel.background = element_rect(fill = "wheat", color = "wheat"),
112 | plot.background = element_rect(fill = "wheat", colour = "wheat"),
113 | legend.background = element_rect(fill = "wheat"),
114 | plot.title = element_text(colour = "black", size=12, hjust = 0.5, face="bold", family="Lucida Sans Typewriter"),
115 | plot.subtitle = element_text(colour = "black", size=10, hjust = 0.5, face="bold", family="Lucida Sans Typewriter"),
116 | plot.caption = element_text(colour = "black", size=8, hjust = 0.5, family="Lucida Sans Typewriter"),
117 | legend.title = element_blank(),
118 | legend.position="none",
119 | legend.justification=c(0.5,0),
120 | plot.margin = unit(c(1.5, 1.5, 0.5, 2), "cm"), #top, right, bottom, left
121 | legend.key = element_rect(fill = "wheat"),
122 | legend.spacing.x = unit(0.1,"cm"),
123 | legend.text = element_text(colour=alpha("black",0.5), size=6, family="Lucida Sans Typewriter", margin = margin(r = 100, unit = "pt")),
124 | axis.title.x= element_blank(),
125 | axis.title.y= element_blank(),
126 | axis.ticks = element_blank(),
127 | axis.text.x=element_blank(),
128 | axis.text.y=element_blank(),
129 | panel.grid.minor = element_blank(),
130 | panel.grid.major = element_blank()
131 | )
132 |
133 | gt1 <- ggplot_gtable(ggplot_build(p1))
134 | gt2 <- ggplot_gtable(ggplot_build(p2))
135 | gt1$widths <- gt2$widths
136 | gt1$heights <- gt2$heights
137 |
138 | #dev.new(width=6,height=8,unit="in", noRStudioGD = TRUE)
139 |
140 | p02 <- cowplot::plot_grid(gt1, gt2, nrow = 2, align = "h") +
141 | theme(plot.background = element_rect(fill = "wheat", colour = "wheat")) +
142 | draw_label("MIGRATION OF NEGROES.\n1890.", x = 0.5, y = 0.92, hjust = 0.5, vjust = 0, fontface=2, fontfamily = "Lucida Sans Typewriter", color = "black", size = 12)
143 | p02
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
--------------------------------------------------------------------------------
/2021/challenge_02.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(ggpubr)
3 | library(extrafont)
4 | library(pBrackets)
5 | library(grid)
6 | tuesdata <- tidytuesdayR::tt_load('2021-02-16')
7 | conjugal <- tuesdata$conjugal
8 | data_long <- gather(conjugal, status, measurement, Single:`Divorced and Widowed`, factor_key=TRUE)
9 | data_long$status <- factor(data_long$status, levels=c("Single", "Married", "Divorced and Widowed"))
10 | data_long$Population <- factor(data_long$Population, levels=rev(c("German", "Negroes")))
11 |
12 | p1 <- ggplot(data=filter(data_long, Age == "15-40"), aes(x=Population, y=measurement, fill=status)) +
13 | geom_bar(stat="identity", width = 0.5) +
14 | labs(title="\n\n") +
15 | scale_fill_manual("", values=c("Single"="red3", "Married"="gold2", "Divorced and Widowed"=alpha("darkgreen",0.6))) +
16 | scale_y_reverse(limits=c(180,0)) +
17 | geom_text(aes(x=c(2,2,2,1,1,1), y=c(68,20.3,0.6,79,32,3), label=c("62.1%", "37.3%", "0.6%", "41%", "54%", "5%")), family="Lucida Sans Typewriter", colour=alpha("black",0.7), size=3) +
18 | annotate("text", x = 1, y = 120, label = "NEGROES", colour = alpha("black",0.7), size=4, family="Lucida Sans Typewriter") +
19 | annotate("text", x = 0.73, y = 120, label = "15-40", colour = alpha("black",0.7), size=2, family="Lucida Sans Typewriter") +
20 | annotate("text", x = 2, y = 120, label = "GERMANY", colour = alpha("black",0.7), size=4, family="Lucida Sans Typewriter") +
21 | annotate("text", x = 1.5, y = 160, label = "15-40", colour = alpha("black",0.7), size=4, family="Lucida Sans Typewriter") +
22 | annotate("text", x = 2, y = 155, label = "AGE", colour = alpha("black",0.7), size=4, family="Lucida Sans Typewriter") +
23 | guides(fill=guide_legend(ncol=2)) +
24 | coord_flip() +
25 | theme(panel.background = element_rect(fill = "wheat"),
26 | plot.background = element_rect(fill = "wheat"),
27 | legend.background = element_rect(fill = "wheat"),
28 | plot.title = element_text(colour = "black", size=12, face="bold", hjust = 0.5),
29 | plot.subtitle = element_text(colour = "black", size=10, face="bold", hjust = 0.5),
30 | legend.title = element_blank(),
31 | legend.position="none",
32 | plot.margin = unit(c(1.5, 0.5, 0, 1), "cm"), #top, right, bottom, left
33 | legend.key = element_rect(colour = "black"),
34 | legend.spacing.x = unit(0.5,"cm"),
35 | legend.text = element_text(colour="black", size=12),
36 | axis.title.x= element_blank(),
37 | axis.title.y= element_blank(),
38 | axis.text.x=element_blank(),
39 | axis.text.y=element_blank(),
40 | axis.ticks.x=element_blank(),
41 | axis.ticks.y=element_blank(),
42 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
43 | )
44 | p1
45 |
46 | p2 <- ggplot(data=filter(data_long, Age == "40-60"), aes(x=Population, y=measurement, fill=status)) +
47 | geom_bar(stat="identity", width = 0.5) +
48 | labs(title="\n\n") +
49 | scale_fill_manual("", values=c("Single"="red3", "Married"="gold2", "Divorced and Widowed"=alpha("darkgreen",0.6))) +
50 | scale_y_reverse(limits=c(180,0)) +
51 | geom_text(aes(x=c(2,2,2,1,1,1), y=c(93,48,4.5,94,56,11), label=c("9.6%", "84.8%", "5.6%", "4.5%", "73.5%", "22%")), family="Lucida Sans Typewriter", colour=alpha("black",0.7), size=3) +
52 | annotate("text", x = 1, y = 120, label = "NEGROES", colour = alpha("black",0.7), size=4, family="Lucida Sans Typewriter") +
53 | annotate("text", x = 0.75, y = 120, label = "40-60", colour = alpha("black",0.7), size=2, family="Lucida Sans Typewriter") +
54 | annotate("text", x = 2, y = 120, label = "GERMANY", colour = alpha("black",0.7), size=4, family="Lucida Sans Typewriter") +
55 | annotate("text", x = 1.5, y = 160, label = "40-60", colour = alpha("black",0.7), size=4, family="Lucida Sans Typewriter") +
56 | guides(fill=guide_legend(ncol=2)) +
57 | coord_flip() +
58 | theme(panel.background = element_rect(fill = "wheat"),
59 | plot.background = element_rect(fill = "wheat"),
60 | legend.background = element_rect(fill = "wheat"),
61 | plot.title = element_text(colour = "black", size=12, face="bold", hjust = 0.5),
62 | plot.subtitle = element_text(colour = "black", size=10, face="bold", hjust = 0.5),
63 | legend.title = element_blank(),
64 | legend.position="none",
65 | plot.margin = unit(c(0, 0.5, 1, 1), "cm"), #top, right, bottom, left
66 | legend.key = element_rect(colour = "black"),
67 | legend.spacing.x = unit(0.5,"cm"),
68 | legend.text = element_text(colour="black", size=12),
69 | axis.title.x= element_blank(),
70 | axis.title.y= element_blank(),
71 | axis.text.x=element_blank(),
72 | axis.text.y=element_blank(),
73 | axis.ticks.x=element_blank(),
74 | axis.ticks.y=element_blank(),
75 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
76 | )
77 | p2
78 |
79 | p3 <- ggplot(data=filter(data_long, Age == "60 and over"), aes(x=Population, y=measurement, fill=status)) +
80 | geom_bar(stat="identity", width = 0.5) +
81 | labs(title="\n\n") +
82 | scale_fill_manual("", values=c("Single"="red3", "Married"="gold2", "Divorced and Widowed"=alpha("darkgreen",0.6))) +
83 | scale_y_reverse(limits=c(180,0)) +
84 | geom_text(aes(x=c(2,2,2,1,1,1), y=c(93,60,14,94,68,20), label=c("8.2%", "62.2%", "29.2%", "4.5%", "54.5%", "41%")), family="Lucida Sans Typewriter", colour=alpha("black",0.7), size=3) +
85 | annotate("text", x = 1, y = 120, label = "NEGROES", colour = alpha("black",0.7), size=4, family="Lucida Sans Typewriter") +
86 | annotate("text", x = 0.73, y = 120, label = "60 AND OVER", colour = alpha("black",0.7), size=2, family="Lucida Sans Typewriter") +
87 | annotate("text", x = 2, y = 120, label = "GERMANY", colour = alpha("black",0.7), size=4, family="Lucida Sans Typewriter") +
88 | annotate("text", x = 1.5, y = 160, label = "60\nAND\nOVER", colour = alpha("black",0.7), size=4, family="Lucida Sans Typewriter") +
89 | guides(fill=guide_legend(ncol=2)) +
90 | coord_flip() +
91 | theme(panel.background = element_rect(fill = "wheat"),
92 | plot.background = element_rect(fill = "wheat"),
93 | legend.background = element_rect(fill = "wheat"),
94 | plot.title = element_text(colour = "black", size=12, face="bold", hjust = 0.5),
95 | plot.subtitle = element_text(colour = "black", size=10, face="bold", hjust = 0.5),
96 | legend.title = element_blank(),
97 | legend.position="none",
98 | plot.margin = unit(c(-0.5, 0.5, 2, 1), "cm"), #top, right, bottom, left
99 | legend.key = element_rect(colour = "black"),
100 | legend.spacing.x = unit(0.5,"cm"),
101 | legend.text = element_text(colour="black", size=12),
102 | axis.title.x= element_blank(),
103 | axis.title.y= element_blank(),
104 | axis.text.x=element_blank(),
105 | axis.text.y=element_blank(),
106 | axis.ticks.x=element_blank(),
107 | axis.ticks.y=element_blank(),
108 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
109 | )
110 | p3
111 |
112 | #dev.new(width=5,height=6.25,unit="in", noRStudioGD = TRUE)
113 |
114 | p <- ggarrange(p1, p2, p3, ncol=1, nrow=3, legend="none")
115 |
116 | p
117 |
118 | g1 <- grid::circleGrob(gp = grid::gpar(fill = "red3"))
119 | g2 <- grid::circleGrob(gp = grid::gpar(fill = "gold1"))
120 | g3 <- grid::circleGrob(gp = grid::gpar(fill = "darkgreen"))
121 |
122 | ggdraw(p) +
123 | draw_label(" CONJUGAL CONDITION .", x = 0.5, y = 0.95, hjust = 0.5, vjust = 0.5, fontface=2, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.7), size = 11) +
124 | draw_grob(g1, x=-0.16, y=0.41, scale = 0.04) +
125 | draw_grob(g2, x=-0.16, y=0.35, scale = 0.04) +
126 | draw_grob(g3, x=0.16, y=0.38, scale = 0.04) +
127 | draw_label("SINGLE", x = 0.38, y = 0.91, hjust = 0, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.7), size = 7) +
128 | draw_label("MARRIED", x = 0.38, y = 0.85, hjust = 0, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.7), size = 7) +
129 | draw_label("WIDOWED AND DIVORCED", x = 0.80, y = 0.88, hjust = 0.5, vjust = 0.5, fontfamily = "Lucida Sans Typewriter", color = alpha("black",0.7), size = 7)
130 |
131 |
132 | #grid.locator(unit="native")
133 |
134 | grid.brackets(160, 190, 160, 120, lwd=0.5, col=alpha("black",0.7))
135 | grid.brackets(160, 340, 160, 270, lwd=0.5, col=alpha("black",0.7))
136 | grid.brackets(160, 510, 160, 440, lwd=0.5, col=alpha("black",0.7))
137 |
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/2021/challenge_05.R:
--------------------------------------------------------------------------------
1 | library(tidyverse)
2 | library(ggpubr)
3 | library(extrafont)
4 | library(pBrackets)
5 | library(grid)
6 | library(cowplot)
7 |
8 | tuesdata <- tidytuesdayR::tt_load('2021-02-16')
9 | income <- tuesdata$income
10 | data_long <- gather(income, type, measurement, Rent:Other, factor_key=TRUE)
11 | data_long$type <- factor(data_long$type, levels=c("Rent", "Food", "Clothes", "Tax", "Other"))
12 | data_long$Class <- factor(data_long$Class, levels=rev(c("$100-200", "$200-300", "$300-400", "$400-500", "$500-750", "$750-1000", "Over $1000")))
13 | data_long$measurement[22] <- 0.1
14 | data_long$measurement[29] <- 9.9
15 |
16 | p <- ggplot() +
17 | geom_bar(data=data_long, aes(x=Class, y=measurement, fill=type), stat="identity", width = 0.5) +
18 | scale_y_reverse() +
19 | scale_fill_manual("", values=c("Rent"="black", "Food"="mediumorchid4", "Clothes"="lightsalmon1", "Tax"="slategray3", "Other"="gray75")) +
20 | #legend
21 | geom_segment(aes(x = 8, y = 0, xend = 8, yend = 20), col='gray75', size=6) +
22 | geom_segment(aes(x = 8, y = 20, xend = 8, yend = 40), col='slategray3', size=6) +
23 | geom_segment(aes(x = 8, y = 40, xend = 8, yend = 60), col='lightsalmon1', size=6) +
24 | geom_segment(aes(x = 8, y = 60, xend = 8, yend = 80), col='mediumorchid4', size=6) +
25 | geom_segment(aes(x = 8, y = 80, xend = 8, yend = 100), col='black', size=6) +
26 | #between lines
27 | geom_segment(aes(x = 7.25, y = 9.9, xend = 7.8, yend = 20), col='black', size=0.1) +
28 | geom_segment(aes(x = 6.25, y = 4, xend = 6.75, yend = 9.9), col='black', size=0.1) +
29 | geom_segment(aes(x = 5.25, y = 11.5, xend = 5.75, yend = 4), col='black', size=0.1) +
30 | geom_segment(aes(x = 4.25, y = 24.5, xend = 4.75, yend = 11.5), col='black', size=0.1) +
31 | geom_segment(aes(x = 3.25, y = 34, xend = 3.75, yend = 24.5), col='black', size=0.1) +
32 | geom_segment(aes(x = 2.25, y = 36, xend = 2.75, yend = 34), col='black', size=0.1) +
33 | geom_segment(aes(x = 1.25, y = 50.5, xend = 1.75, yend = 36), col='black', size=0.1) +
34 | #
35 | geom_segment(aes(x = 7.25, y = 10, xend = 7.8, yend = 40), col='black', size=0.1) +
36 | geom_segment(aes(x = 6.25, y = 8, xend = 6.75, yend = 10), col='black', size=0.1) +
37 | geom_segment(aes(x = 5.25, y = 16, xend = 5.75, yend = 8), col='black', size=0.1) +
38 | geom_segment(aes(x = 4.25, y = 30, xend = 4.75, yend = 16), col='black', size=0.1) +
39 | geom_segment(aes(x = 3.25, y = 39, xend = 3.75, yend = 30), col='black', size=0.1) +
40 | geom_segment(aes(x = 2.25, y = 44, xend = 2.75, yend = 39), col='black', size=0.1) +
41 | geom_segment(aes(x = 1.25, y = 55, xend = 1.75, yend = 44), col='black', size=0.1) +
42 | #
43 | geom_segment(aes(x = 7.25, y = 38, xend = 7.8, yend = 60), col='black', size=0.1) +
44 | geom_segment(aes(x = 6.25, y = 31, xend = 6.75, yend = 38), col='black', size=0.1) +
45 | geom_segment(aes(x = 5.25, y = 34, xend = 5.75, yend = 31), col='black', size=0.1) +
46 | geom_segment(aes(x = 4.25, y = 45, xend = 4.75, yend = 34), col='black', size=0.1) +
47 | geom_segment(aes(x = 3.25, y = 56, xend = 3.75, yend = 45), col='black', size=0.1) +
48 | geom_segment(aes(x = 2.25, y = 63, xend = 2.75, yend = 56), col='black', size=0.1) +
49 | geom_segment(aes(x = 1.25, y = 71, xend = 1.75, yend = 63), col='black', size=0.1) +
50 | #
51 | geom_segment(aes(x = 7.25, y = 81, xend = 7.8, yend = 80), col='black', size=0.1) +
52 | geom_segment(aes(x = 6.25, y = 78, xend = 6.75, yend = 81), col='black', size=0.1) +
53 | geom_segment(aes(x = 5.25, y = 77, xend = 5.75, yend = 78), col='black', size=0.1) +
54 | geom_segment(aes(x = 4.25, y = 82, xend = 4.75, yend = 77), col='black', size=0.1) +
55 | geom_segment(aes(x = 3.25, y = 87, xend = 3.75, yend = 82), col='black', size=0.1) +
56 | geom_segment(aes(x = 2.25, y = 100, xend = 2.75, yend = 87), col='black', size=0.1) +
57 | #left arrows
58 | geom_segment(aes(x = seq(0.5,7.5,1), y = rep(137,8), xend = seq(0.5,7.5,1), yend = rep(98,8)), col='black', size=0.3, arrow=arrow(length = unit(0.03, "npc"))) +
59 | geom_segment(aes(x = 7.8, y = 103, xend = 7.8, yend = 137), col='black', size=0.3) +
60 | geom_segment(aes(x = 0.5, y = 137, xend = 7.8, yend = 137), col='black', size=0.3) +
61 | geom_segment(aes(x = 0.5, y = 119, xend = 7.8, yend = 119), col='black', size=0.3) +
62 | geom_segment(aes(x = 0.5, y = 103, xend = 7.8, yend = 103), col='black', size=0.3) +
63 | #add percentages
64 | #clothes
65 | geom_text(data=data.frame(x=c(7:1), y=100-c(75, 80, 76, 63, 52, 45, 37),
66 | label=c("28%", "23%", "18%", "15%", "17%", "19%", "16%")),
67 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=3, hjust=0.5, colour="black") +
68 | #tax
69 | geom_text(data=data.frame(x=c(6:1), y=c(6, 14, 27, 36, 40, 52),
70 | label=c("4%", "4.5%", "5.5%", "5%", "8%", "4.5%")),
71 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=3, hjust=0.5, colour="black") +
72 | #other
73 | geom_text(data=data.frame(x=c(7:1), y=c(5, 2, 6, 13, 17, 18, 25),
74 | label=c("9.9%", "4%", "11.5%", "24.5%", "34%", "36%", "50.5%")),
75 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=3, hjust=0.5, colour="black") +
76 | #food
77 | geom_text(data=data.frame(x=c(7:1), y=100-c(40, 42, 44, 39, 33, 20, 15),
78 | label=c("43%", "47%", "43%", "37%", "31%", "37%", "29%")),
79 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=3, hjust=0.5, colour="black") +
80 | #rent
81 | geom_text(data=data.frame(x=c(7:3), y=100-c(10, 13, 12, 9, 7),
82 | label=c("19%", "22%", "23%", "18%", "13%")),
83 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=3, hjust=0.5, colour="white") +
84 | #values
85 | geom_text(data=data.frame(x=c(2:7), y=rep(135,6),
86 | label=rev(c("$100-200", "$200-300", "$300-400", "$400-500", "$500-750", "$750-1000"))),
87 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=3, hjust=0) +
88 | geom_text(data=data.frame(x=1, y=129,
89 | label=("1,000\nAND OVER")),
90 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=3, hjust=0.5) +
91 | geom_text(data=data.frame(x=c(1:7), y=rep(117,7),
92 | label=rev(sapply(income$`Actual Average`, function(x) paste("$", x, sep="")))),
93 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=3, hjust=0) +
94 | labs(title="INCOME AND EXPENDITURE OF 150 NEGRO FAMILIES IN ATLANTA, GA., U.S.A.\n\n\n\n\n\n\n\n",
95 | caption="FOR FURTHER STATISTICS RAISE THIS FRAME.\n") +
96 | #rhs labels
97 | geom_text(data=data.frame(x=c(1, 2.5, 4.5, 6.5), y=rep(-7,4),
98 | label=rev(c("POOR", "FAR", "CONFORTABLE", "WELL-TO-DO"))),
99 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=2.5, hjust=0.5, angle=90) +
100 | #table labels
101 | geom_text(data=data.frame(x=c(7.7,7.7), y=c(111,128),
102 | label=c("ACTUAL AVERAGE", "CLASS")),
103 | aes(x=x, y=y, label=label), family="Lucida Sans Typewriter", size=2.5, hjust=0.5) +
104 | #design
105 | coord_flip() +
106 | theme(panel.background = element_rect(fill = "#d0bba8"),
107 | plot.background = element_rect(fill = "#d0bba8"),
108 | legend.background = element_rect(fill = "#d0bba8"),
109 | plot.title = element_text(colour = "black", size=12, face="bold", hjust = 0.5, family="Lucida Sans Typewriter"),
110 | plot.subtitle = element_text(colour = "black", size=10, hjust = 0, family="Lucida Sans Typewriter"),
111 | plot.caption = element_text(colour = "black", size=8, hjust = 0.7, family="Lucida Sans Typewriter"),
112 | legend.title = element_blank(),
113 | legend.position="none",
114 | plot.margin = unit(c(0.5, 0, 0, 0.5), "cm"), #top, right, bottom, left
115 | legend.key = element_rect(colour = "black"),
116 | legend.spacing.x = unit(0.5,"cm"),
117 | legend.text = element_text(colour="black", size=12),
118 | axis.title.x= element_blank(),
119 | axis.title.y= element_blank(),
120 | axis.text.x=element_blank(),
121 | axis.text.y=element_blank(),
122 | axis.ticks.x=element_blank(),
123 | legend.key.width = unit(1.5,"cm"),
124 | axis.ticks.y=element_blank(),
125 | panel.grid.major = element_blank(), panel.grid.minor = element_blank()
126 | )
127 | p
128 |
129 | #grid.locator(unit="native")
130 | logo_file <- system.file("extdata", "2021/data/images/original_05.jpg", package = "cowplot")
131 | q <- ggdraw() +
132 | draw_plot(p) +
133 | draw_image("2021/data/images/original_05.jpg",
134 | x = 0.1, y = 0.3, scale = .6) +
135 | draw_image("2021/data/images/original_05b.jpg",
136 | x = -0.35, y = 0.3, scale = .2)
137 | q
138 | grid.brackets(696, 217, 696, 286, lwd=0.5, col=alpha("black",0.7))
139 | grid.brackets(696, 308, 696, 379, lwd=0.5, col=alpha("black",0.7))
140 | grid.brackets(696, 398, 696, 471, lwd=0.5, col=alpha("black",0.7))
141 | grid.brackets(696, 493, 696, 521, lwd=0.5, col=alpha("black",0.7))
142 |
143 | dev.new(width=8,height=6,unit="in", noRStudioGD = TRUE)
144 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Attribution 4.0 International
2 |
3 | =======================================================================
4 |
5 | Creative Commons Corporation ("Creative Commons") is not a law firm and
6 | does not provide legal services or legal advice. Distribution of
7 | Creative Commons public licenses does not create a lawyer-client or
8 | other relationship. Creative Commons makes its licenses and related
9 | information available on an "as-is" basis. Creative Commons gives no
10 | warranties regarding its licenses, any material licensed under their
11 | terms and conditions, or any related information. Creative Commons
12 | disclaims all liability for damages resulting from their use to the
13 | fullest extent possible.
14 |
15 | Using Creative Commons Public Licenses
16 |
17 | Creative Commons public licenses provide a standard set of terms and
18 | conditions that creators and other rights holders may use to share
19 | original works of authorship and other material subject to copyright
20 | and certain other rights specified in the public license below. The
21 | following considerations are for informational purposes only, are not
22 | exhaustive, and do not form part of our licenses.
23 |
24 | Considerations for licensors: Our public licenses are
25 | intended for use by those authorized to give the public
26 | permission to use material in ways otherwise restricted by
27 | copyright and certain other rights. Our licenses are
28 | irrevocable. Licensors should read and understand the terms
29 | and conditions of the license they choose before applying it.
30 | Licensors should also secure all rights necessary before
31 | applying our licenses so that the public can reuse the
32 | material as expected. Licensors should clearly mark any
33 | material not subject to the license. This includes other CC-
34 | licensed material, or material used under an exception or
35 | limitation to copyright. More considerations for licensors:
36 | wiki.creativecommons.org/Considerations_for_licensors
37 |
38 | Considerations for the public: By using one of our public
39 | licenses, a licensor grants the public permission to use the
40 | licensed material under specified terms and conditions. If
41 | the licensor's permission is not necessary for any reason--for
42 | example, because of any applicable exception or limitation to
43 | copyright--then that use is not regulated by the license. Our
44 | licenses grant only permissions under copyright and certain
45 | other rights that a licensor has authority to grant. Use of
46 | the licensed material may still be restricted for other
47 | reasons, including because others have copyright or other
48 | rights in the material. A licensor may make special requests,
49 | such as asking that all changes be marked or described.
50 | Although not required by our licenses, you are encouraged to
51 | respect those requests where reasonable. More considerations
52 | for the public:
53 | wiki.creativecommons.org/Considerations_for_licensees
54 |
55 | =======================================================================
56 |
57 | Creative Commons Attribution 4.0 International Public License
58 |
59 | By exercising the Licensed Rights (defined below), You accept and agree
60 | to be bound by the terms and conditions of this Creative Commons
61 | Attribution 4.0 International Public License ("Public License"). To the
62 | extent this Public License may be interpreted as a contract, You are
63 | granted the Licensed Rights in consideration of Your acceptance of
64 | these terms and conditions, and the Licensor grants You such rights in
65 | consideration of benefits the Licensor receives from making the
66 | Licensed Material available under these terms and conditions.
67 |
68 |
69 | Section 1 -- Definitions.
70 |
71 | a. Adapted Material means material subject to Copyright and Similar
72 | Rights that is derived from or based upon the Licensed Material
73 | and in which the Licensed Material is translated, altered,
74 | arranged, transformed, or otherwise modified in a manner requiring
75 | permission under the Copyright and Similar Rights held by the
76 | Licensor. For purposes of this Public License, where the Licensed
77 | Material is a musical work, performance, or sound recording,
78 | Adapted Material is always produced where the Licensed Material is
79 | synched in timed relation with a moving image.
80 |
81 | b. Adapter's License means the license You apply to Your Copyright
82 | and Similar Rights in Your contributions to Adapted Material in
83 | accordance with the terms and conditions of this Public License.
84 |
85 | c. Copyright and Similar Rights means copyright and/or similar rights
86 | closely related to copyright including, without limitation,
87 | performance, broadcast, sound recording, and Sui Generis Database
88 | Rights, without regard to how the rights are labeled or
89 | categorized. For purposes of this Public License, the rights
90 | specified in Section 2(b)(1)-(2) are not Copyright and Similar
91 | Rights.
92 |
93 | d. Effective Technological Measures means those measures that, in the
94 | absence of proper authority, may not be circumvented under laws
95 | fulfilling obligations under Article 11 of the WIPO Copyright
96 | Treaty adopted on December 20, 1996, and/or similar international
97 | agreements.
98 |
99 | e. Exceptions and Limitations means fair use, fair dealing, and/or
100 | any other exception or limitation to Copyright and Similar Rights
101 | that applies to Your use of the Licensed Material.
102 |
103 | f. Licensed Material means the artistic or literary work, database,
104 | or other material to which the Licensor applied this Public
105 | License.
106 |
107 | g. Licensed Rights means the rights granted to You subject to the
108 | terms and conditions of this Public License, which are limited to
109 | all Copyright and Similar Rights that apply to Your use of the
110 | Licensed Material and that the Licensor has authority to license.
111 |
112 | h. Licensor means the individual(s) or entity(ies) granting rights
113 | under this Public License.
114 |
115 | i. Share means to provide material to the public by any means or
116 | process that requires permission under the Licensed Rights, such
117 | as reproduction, public display, public performance, distribution,
118 | dissemination, communication, or importation, and to make material
119 | available to the public including in ways that members of the
120 | public may access the material from a place and at a time
121 | individually chosen by them.
122 |
123 | j. Sui Generis Database Rights means rights other than copyright
124 | resulting from Directive 96/9/EC of the European Parliament and of
125 | the Council of 11 March 1996 on the legal protection of databases,
126 | as amended and/or succeeded, as well as other essentially
127 | equivalent rights anywhere in the world.
128 |
129 | k. You means the individual or entity exercising the Licensed Rights
130 | under this Public License. Your has a corresponding meaning.
131 |
132 |
133 | Section 2 -- Scope.
134 |
135 | a. License grant.
136 |
137 | 1. Subject to the terms and conditions of this Public License,
138 | the Licensor hereby grants You a worldwide, royalty-free,
139 | non-sublicensable, non-exclusive, irrevocable license to
140 | exercise the Licensed Rights in the Licensed Material to:
141 |
142 | a. reproduce and Share the Licensed Material, in whole or
143 | in part; and
144 |
145 | b. produce, reproduce, and Share Adapted Material.
146 |
147 | 2. Exceptions and Limitations. For the avoidance of doubt, where
148 | Exceptions and Limitations apply to Your use, this Public
149 | License does not apply, and You do not need to comply with
150 | its terms and conditions.
151 |
152 | 3. Term. The term of this Public License is specified in Section
153 | 6(a).
154 |
155 | 4. Media and formats; technical modifications allowed. The
156 | Licensor authorizes You to exercise the Licensed Rights in
157 | all media and formats whether now known or hereafter created,
158 | and to make technical modifications necessary to do so. The
159 | Licensor waives and/or agrees not to assert any right or
160 | authority to forbid You from making technical modifications
161 | necessary to exercise the Licensed Rights, including
162 | technical modifications necessary to circumvent Effective
163 | Technological Measures. For purposes of this Public License,
164 | simply making modifications authorized by this Section 2(a)
165 | (4) never produces Adapted Material.
166 |
167 | 5. Downstream recipients.
168 |
169 | a. Offer from the Licensor -- Licensed Material. Every
170 | recipient of the Licensed Material automatically
171 | receives an offer from the Licensor to exercise the
172 | Licensed Rights under the terms and conditions of this
173 | Public License.
174 |
175 | b. No downstream restrictions. You may not offer or impose
176 | any additional or different terms or conditions on, or
177 | apply any Effective Technological Measures to, the
178 | Licensed Material if doing so restricts exercise of the
179 | Licensed Rights by any recipient of the Licensed
180 | Material.
181 |
182 | 6. No endorsement. Nothing in this Public License constitutes or
183 | may be construed as permission to assert or imply that You
184 | are, or that Your use of the Licensed Material is, connected
185 | with, or sponsored, endorsed, or granted official status by,
186 | the Licensor or others designated to receive attribution as
187 | provided in Section 3(a)(1)(A)(i).
188 |
189 | b. Other rights.
190 |
191 | 1. Moral rights, such as the right of integrity, are not
192 | licensed under this Public License, nor are publicity,
193 | privacy, and/or other similar personality rights; however, to
194 | the extent possible, the Licensor waives and/or agrees not to
195 | assert any such rights held by the Licensor to the limited
196 | extent necessary to allow You to exercise the Licensed
197 | Rights, but not otherwise.
198 |
199 | 2. Patent and trademark rights are not licensed under this
200 | Public License.
201 |
202 | 3. To the extent possible, the Licensor waives any right to
203 | collect royalties from You for the exercise of the Licensed
204 | Rights, whether directly or through a collecting society
205 | under any voluntary or waivable statutory or compulsory
206 | licensing scheme. In all other cases the Licensor expressly
207 | reserves any right to collect such royalties.
208 |
209 |
210 | Section 3 -- License Conditions.
211 |
212 | Your exercise of the Licensed Rights is expressly made subject to the
213 | following conditions.
214 |
215 | a. Attribution.
216 |
217 | 1. If You Share the Licensed Material (including in modified
218 | form), You must:
219 |
220 | a. retain the following if it is supplied by the Licensor
221 | with the Licensed Material:
222 |
223 | i. identification of the creator(s) of the Licensed
224 | Material and any others designated to receive
225 | attribution, in any reasonable manner requested by
226 | the Licensor (including by pseudonym if
227 | designated);
228 |
229 | ii. a copyright notice;
230 |
231 | iii. a notice that refers to this Public License;
232 |
233 | iv. a notice that refers to the disclaimer of
234 | warranties;
235 |
236 | v. a URI or hyperlink to the Licensed Material to the
237 | extent reasonably practicable;
238 |
239 | b. indicate if You modified the Licensed Material and
240 | retain an indication of any previous modifications; and
241 |
242 | c. indicate the Licensed Material is licensed under this
243 | Public License, and include the text of, or the URI or
244 | hyperlink to, this Public License.
245 |
246 | 2. You may satisfy the conditions in Section 3(a)(1) in any
247 | reasonable manner based on the medium, means, and context in
248 | which You Share the Licensed Material. For example, it may be
249 | reasonable to satisfy the conditions by providing a URI or
250 | hyperlink to a resource that includes the required
251 | information.
252 |
253 | 3. If requested by the Licensor, You must remove any of the
254 | information required by Section 3(a)(1)(A) to the extent
255 | reasonably practicable.
256 |
257 | 4. If You Share Adapted Material You produce, the Adapter's
258 | License You apply must not prevent recipients of the Adapted
259 | Material from complying with this Public License.
260 |
261 |
262 | Section 4 -- Sui Generis Database Rights.
263 |
264 | Where the Licensed Rights include Sui Generis Database Rights that
265 | apply to Your use of the Licensed Material:
266 |
267 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right
268 | to extract, reuse, reproduce, and Share all or a substantial
269 | portion of the contents of the database;
270 |
271 | b. if You include all or a substantial portion of the database
272 | contents in a database in which You have Sui Generis Database
273 | Rights, then the database in which You have Sui Generis Database
274 | Rights (but not its individual contents) is Adapted Material; and
275 |
276 | c. You must comply with the conditions in Section 3(a) if You Share
277 | all or a substantial portion of the contents of the database.
278 |
279 | For the avoidance of doubt, this Section 4 supplements and does not
280 | replace Your obligations under this Public License where the Licensed
281 | Rights include other Copyright and Similar Rights.
282 |
283 |
284 | Section 5 -- Disclaimer of Warranties and Limitation of Liability.
285 |
286 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
287 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
288 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
289 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
290 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
291 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
292 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
293 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
294 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
295 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
296 |
297 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
298 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
299 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
300 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
301 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
302 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
303 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
304 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
305 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
306 |
307 | c. The disclaimer of warranties and limitation of liability provided
308 | above shall be interpreted in a manner that, to the extent
309 | possible, most closely approximates an absolute disclaimer and
310 | waiver of all liability.
311 |
312 |
313 | Section 6 -- Term and Termination.
314 |
315 | a. This Public License applies for the term of the Copyright and
316 | Similar Rights licensed here. However, if You fail to comply with
317 | this Public License, then Your rights under this Public License
318 | terminate automatically.
319 |
320 | b. Where Your right to use the Licensed Material has terminated under
321 | Section 6(a), it reinstates:
322 |
323 | 1. automatically as of the date the violation is cured, provided
324 | it is cured within 30 days of Your discovery of the
325 | violation; or
326 |
327 | 2. upon express reinstatement by the Licensor.
328 |
329 | For the avoidance of doubt, this Section 6(b) does not affect any
330 | right the Licensor may have to seek remedies for Your violations
331 | of this Public License.
332 |
333 | c. For the avoidance of doubt, the Licensor may also offer the
334 | Licensed Material under separate terms or conditions or stop
335 | distributing the Licensed Material at any time; however, doing so
336 | will not terminate this Public License.
337 |
338 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
339 | License.
340 |
341 |
342 | Section 7 -- Other Terms and Conditions.
343 |
344 | a. The Licensor shall not be bound by any additional or different
345 | terms or conditions communicated by You unless expressly agreed.
346 |
347 | b. Any arrangements, understandings, or agreements regarding the
348 | Licensed Material not stated herein are separate from and
349 | independent of the terms and conditions of this Public License.
350 |
351 |
352 | Section 8 -- Interpretation.
353 |
354 | a. For the avoidance of doubt, this Public License does not, and
355 | shall not be interpreted to, reduce, limit, restrict, or impose
356 | conditions on any use of the Licensed Material that could lawfully
357 | be made without permission under this Public License.
358 |
359 | b. To the extent possible, if any provision of this Public License is
360 | deemed unenforceable, it shall be automatically reformed to the
361 | minimum extent necessary to make it enforceable. If the provision
362 | cannot be reformed, it shall be severed from this Public License
363 | without affecting the enforceability of the remaining terms and
364 | conditions.
365 |
366 | c. No term or condition of this Public License will be waived and no
367 | failure to comply consented to unless expressly agreed to by the
368 | Licensor.
369 |
370 | d. Nothing in this Public License constitutes or may be interpreted
371 | as a limitation upon, or waiver of, any privileges and immunities
372 | that apply to the Licensor or You, including from the legal
373 | processes of any jurisdiction or authority.
374 |
375 |
376 | =======================================================================
377 |
378 | Creative Commons is not a party to its public
379 | licenses. Notwithstanding, Creative Commons may elect to apply one of
380 | its public licenses to material it publishes and in those instances
381 | will be considered the “Licensor.” The text of the Creative Commons
382 | public licenses is dedicated to the public domain under the CC0 Public
383 | Domain Dedication. Except for the limited purpose of indicating that
384 | material is shared under a Creative Commons public license or as
385 | otherwise permitted by the Creative Commons policies published at
386 | creativecommons.org/policies, Creative Commons does not authorize the
387 | use of the trademark "Creative Commons" or any other trademark or logo
388 | of Creative Commons without its prior written consent including,
389 | without limitation, in connection with any unauthorized modifications
390 | to any of its public licenses or any other arrangements,
391 | understandings, or agreements concerning use of licensed material. For
392 | the avoidance of doubt, this paragraph does not form part of the
393 | public licenses.
394 |
395 | Creative Commons may be contacted at creativecommons.org.
396 |
--------------------------------------------------------------------------------