Skip to content

Instantly share code, notes, and snippets.

@ikashnitsky
Last active July 19, 2022 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikashnitsky/60fc613f5ffd367f5bc66361eb14b874 to your computer and use it in GitHub Desktop.
Save ikashnitsky/60fc613f5ffd367f5bc66361eb14b874 to your computer and use it in GitHub Desktop.
@dicook
Copy link

dicook commented Jun 23, 2021

Couldn't save and upload a gif, but here is the code, was playing with animation. Not something to hang a hat on, but along the lines of trying to pixellate, to see how varied age is by teams:

#===============================================================================

2021-06-23 -- Rosrock Retreat

Dataviz challenge -- EURO 2020 data

Ilya Kashnitsky, ilya.kashnitsky@gmail.com

#===============================================================================

Dataset is a detailed team squads data from Transfermarkt

https://www.transfermarkt.com/euro-2020/teilnehmer/pokalwettbewerb/EM20

For each country it looks like this

https://www.transfermarkt.com/england/startseite/verein/3299

library(tidyverse)
library(magrittr)

load the dataset

source("https://gist.githubusercontent.com/ikashnitsky/5f305b91aacd5ea61dbd64a2f938773d/raw/a3eb3d280946023cd66601de100482a36b144d6c/euro_2020_players.R")

check the dataset

euro_2020_players %>% print()

# consider

euro_2020_players %>% xray::distributions()

Have fun!

Link to submit your output

https://docs.google.com/forms/d/e/1FAIpQLSf2IPZ4-A4ZuT6_JkIrE1-Cs3-fzsHr_rGdwvUqevF47_dIMw/viewform

library(gganimate)
library(forcats)
p <- ggplot(euro_2020_players) +
geom_point(aes(x=fct_reorder(country, age), y=age), alpha=0.8) +
coord_flip() +
transition_states(no, transition_length = 3, state_length = 1)
p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment