library(tidyverse)
<- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-04-19/big_dave.csv')
big_dave <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-04-19/times.csv') times
%>%glimpse
big_dave%>%arrange(-rowid)%>%head big_dave
<- big_dave%>% # DataExplorer::profile_missing()
big_dave1 select(answer,puzzle_date,puzzle_name) %>%
filter(!is.na(answer)) %>%
mutate(puzzle_bigdave=gsub("[[:punct:][:blank:]]\\d*","",puzzle_name))
%>%count(answer) big_dave1
%>%glimpse
times%>%head times
<- times%>%
times1 select(answer,puzzle_date,puzzle_name) %>% #DataExplorer::profile_missing()
filter(!is.na(answer))%>%
mutate(puzzle_times=gsub("[[:punct:][:blank:]]\\d*","",puzzle_name))
%>%count(answer) times1
<- big_dave1 %>%
df inner_join(times1,by=c("answer","puzzle_date")) %>%
arrange(puzzle_date) %>% #
mutate(answer=as.factor(answer)) %>% #DataExplorer::profile_missing()
select(-puzzle_name.x,-puzzle_name.y) %>%
mutate(year=lubridate::year(puzzle_date),.after=answer,
year=as.integer(year))
df
%>%
dfggplot(aes(x=year,y=puzzle_bigdave))+
geom_col()
library(gganimate)
<- colorRampPalette(RColorBrewer::brewer.pal(12, "Paired"))(161)
colorslibrary(extrafont)
loadfonts()
library(showtext)
#
font_add_google("Gentium Book Basic","gbb")
font_add_google("Nanum Gothic","ng")
showtext_auto()
<- df %>%
p pivot_longer(cols=c("puzzle_bigdave","puzzle_times"),
names_to="names",values_to="values")%>%
#count(year)
ggplot(aes(puzzle_date, fct_reorder(values,puzzle_date), color = values)) +
geom_jitter(show.legend = F,shape=".",color="white")+
geom_text(aes(label=answer),
size=9,
check_overlap = T,family="gbb")+
scale_color_manual(values=colors)+
labs(title = "\nSame Answers! Year: {closest_state}\nBigDave & Times puzzles\n",
subtitle="\nwords are randomized",
caption="#30DayChartChallenge 2022 #Day22\n DataSource: #TidyTuesday week16 - Crossword \n DataViz: Federica Gazzelloni\n\n")+
theme_void() +
theme(text = element_text(family = "ng", face="bold",color="#F0F8FF"),
plot.title = element_text(size=28),
plot.subtitle = element_text(size=18),
plot.caption = element_text(size=14,vjust=2,hjust=0.5),
plot.background = element_rect(fill="grey10",color="grey20"),
panel.background = element_rect(fill="grey10",color="grey20"),
legend.position = "none")+
coord_polar(theta = "x") +
transition_states(year,
transition_length = 2,
state_length = 1,
wrap = F) +
shadow_wake(wake_length = 0.5,wrap=F)
anim_save(animate(p,res=100,
renderer = gifski_renderer("animation3.gif"),
height = 710, width = 610))