library(tidyverse)
<- tidytuesdayR::tt_load(2023, week = 07) tuesdata
<- tuesdata$age_gaps
age_gaps %>%head age_gaps
%>%names age_gaps
%>%dim age_gaps
library(geomtextpath)
%>%
age_gapsgroup_by(movie_name)%>%
mutate(avg=mean(age_difference))%>%
pivot_longer(cols = c("character_1_gender","character_2_gender"),names_to = "type",values_to = "gender") %>%
mutate(type=ifelse(type=="character_1_gender","First Character Gender","Second Character Gender")) %>%
ggplot(aes(avg,fill=gender))+
geom_histogram()+
facet_wrap(~type)+
::scale_fill_brooklyn99(reverse=FALSE)+
tvthemeslabs(title="Hollywood Age Gaps",
subtitle="Age difference - Avg values",
caption="\nDataSource: #TidyTuesday 2023 Week7 Hollywood Age Gaps\nDataViz: Federica Gazzelloni #30DayChartChallenge 2023 Day9 - high/low\n",x="",y="Count")+
::theme_brooklyn99(text.font="Roboto Condensed")+
tvthemestheme(panel.grid = element_line(linetype="dashed",linewidth = 0.2),
strip.text = element_text(face="bold"))+
annotate(
"textsegment",
x=60,xend=20,y=150,yend=70,
label = "high/low", arrow = arrow(length = unit(5,units = "pt"))
)
ggsave("w7_HIAG.png",
width = 7,height = 5)