-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathbechdel_test.Rmd
170 lines (132 loc) · 6 KB
/
bechdel_test.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
---
title: "Bechdel Test"
author: "Christophe Nicault"
date: "10/03/2021"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r load_packages}
library(tidytuesdayR)
library(tidyverse)
library(patchwork)
library(ggstream)
library(ggbeeswarm)
library(ggtext)
library(showtext)
font_add_google("Oswald", "oswald")
font_add_google("Roboto", "roboto")
font_add_google("Roboto Condensed", "roboto condensed")
font_add_google("Share Tech Mono", "techmono")
showtext_opts(dpi = 320)
showtext_auto(enable = TRUE)
theme_set(theme_void(base_family = "roboto condensed"))
```
```{r load_data}
tuesdata <- tt_load(2021, week = 11)
readme(tuesdata)
```
```{r data_preparation}
bechdel_df <- tuesdata$movies %>%
mutate(clean_test = case_when(
clean_test == "ok" ~ "Pass Bechdel",
clean_test == "dubious" ~ "Dubious",
clean_test == "men" ~ "About men",
clean_test == "notalk" ~ "No talk",
clean_test == "nowomen" ~ "No women",
)) %>%
mutate(
clean_test = as.factor(clean_test),
clean_test = fct_relevel(clean_test, c("Pass Bechdel", "Dubious", "About men", "No talk", "No women"))
)
perc_rating <- bechdel_df %>%
count(year, clean_test) %>%
group_by(year) %>%
mutate(perc_rating = n / sum(n))
```
```{r color_parameters}
palette <- c("Pass Bechdel" = "#3C989E", "Dubious" = "#F4CDA5", "No women" = "#BA415D", "No talk" = "#ED5276", "About men" = "#F09CB0")
bck_clr <- "grey30"
```
```{r beeswarm_plot}
text <- "The Bechdel test, invented by Alison Bechdel, allows the evaluation of the female presence in a movie,<br> thanks to three criteria: <br>- the movie has to have at least two women in it,<br>- who talk to each other,<br>- about something else than men.<br>If the movie has <span style='color:#BA415D'>**no women**</span>, or <span style='color:#ED5276'>**they don't talk to each other**</span>, or <span style='color:#F09CB0'>**they talk about men**</span>, it fails the test.<br>The movie is described as <span style='color:#F4CDA5'>**dubious**</span> when it's unclear for the contributor if it should pass the test.<br>We can see that over time more movies <span style='color:#3C989E'>**pass the test**</span>, however, until mid-90's, the number of movies<br> tested was too low to be meaningful.<br>Since then, only about 50% of films pass the test.<br>The categories that are more than 50% successful are Comedy, Drama, and Horror.<br>The categories which do not have enough films are grouped together<br> in a category called \"Less common genres\"."
bechdel_beeswarm <- bechdel_df %>%
group_by(year) %>%
arrange(clean_test) %>%
mutate(position = row_number()) %>%
ggplot(aes(year, position, color = clean_test)) +
geom_beeswarm(size = 0.6) +
annotate("richtext", x = 1970, y = 70, label = text, hjust = 0, color = "white", size = 3, fill = NA, label.color = NA, lineheight = unit(1.3, "line")) +
scale_color_manual(values = palette) +
scale_x_continuous(breaks = seq(1970,2010,10), expand = c(0.01, 0.01)) +
guides(color = FALSE) +
theme_void()+
theme(plot.background = element_rect(fill = bck_clr, color = NA),
strip.text = element_text(color = "white", margin = margin(5,0,0,0)),
legend.position = "bottom",
axis.text.x = element_text(color = "white", size = 9, margin = margin(10,0,0,0)),
axis.ticks.x = element_line(color = "white"),
plot.margin = margin(0,0,10,0))
```
```{r stream_plot}
bechdel_stream <- perc_rating %>%
ggplot(aes(year, perc_rating, fill = clean_test)) +
geom_stream() +
scale_fill_manual(values = palette) +
scale_x_continuous(breaks = seq(1970,2010,10), expand = c(0.01, 0.01)) +
guides(fill = guide_legend(label.position = "top",
title.hjust = 0.5,
keywidth = unit(4, "line"),
keyheight = unit(1, "line"),
nrow = 1
)
)+
theme_void()+
theme(
plot.background = element_rect(fill = bck_clr, color = NA),
strip.text = element_text(color = "white"),
legend.position = "bottom",
legend.text = element_text(color = "white", size = 9),
legend.title = element_blank()
)
```
```{r genre_plot}
bechdel_genre <- bechdel_df %>%
mutate(main_genre = str_remove(word(genre, 1), ","),
main_genre = fct_lump_n(main_genre, 7, other_level = "Less common\n genres"),
clean_test = as.factor(clean_test),
binary = str_to_title(binary)) %>%
filter(!is.na(main_genre)) %>%
count(clean_test, main_genre, binary) %>%
group_by(main_genre) %>%
mutate(perc_rating = n / sum(n)) %>%
ggplot(aes(binary, perc_rating, fill = clean_test)) +
geom_col() +
scale_fill_manual(values = palette) +
facet_wrap(~main_genre, scales = "free_y", ncol = 8) +
guides(fill = FALSE) +
theme_void()+
theme(plot.background = element_rect(fill = bck_clr, color = NA),
strip.text = element_text(color = "white", margin = margin(0,0,5,0)),
plot.margin = margin(30,0,0,0),
panel.spacing.x = unit(1.5, "lines"))
```
```{r final_plot}
final <- bechdel_beeswarm / bechdel_stream / bechdel_genre +
plot_layout(nrow = 3, heights = c(1, 0.5, 0.2)) +
plot_annotation(
title = "Bechdel Test - Presence of women in films",
caption = "Visualization: Christophe Nicault | Data: FiveThirtyEight",
theme = theme(
plot.margin = margin(10,20,10,20),
plot.background = element_rect(fill = bck_clr, color = NA),
plot.title = element_text(family = "oswald", size = 20, hjust = 0.5, margin = margin(10,0,0,0), color = "white"),
plot.subtitle = element_text(family = "roboto", size = 10, hjust = 0.5, margin = margin(5,0,0,0), lineheight = 1.1),
plot.caption = element_text(family = "techmono", size = 8, color = "white", margin = margin(15,0,0,0))
)
)
ragg::agg_png(here::here("render", paste0("bechdel_test_", format(Sys.time(), "%Y%m%d_%H%M%S"), ".png")), res = 320, width = 10, height = 8, units = "in")
final
dev.off()
```