Skip to content

Instantly share code, notes, and snippets.

@conormm
Last active May 15, 2017 06:35
Show Gist options
  • Save conormm/deaf9e8b1306bbcc2d684cb35c2992eb to your computer and use it in GitHub Desktop.
Save conormm/deaf9e8b1306bbcc2d684cb35c2992eb to your computer and use it in GitHub Desktop.
library(readxl)
library(janitor)
library(ggraph)
library(igraph)
df <- readxl::read_excel("/eurovision_song_contest_1975_2016.xlsx") %>%
clean_names()
df <- df[, c(5, 6, 1:4, 7)]
oneyear <- df %>% filter(year %in% c(2015, 2016) & points > 6 & x_semi_final == "f") %>% igraph::graph_from_data_frame()
V(oneyear)$points <- degree(oneyear)
V(oneyear)$country <- names(V(oneyear))
oneyear %>%
ggraph() +
geom_edge_fan(aes(alpha = ..index..), show.legend = FALSE) +
geom_node_point(aes(size = points, colour = country), alpha = 0.6) +
theme_graph(foreground = "steelblue", fg_text_colour = "white") +
labs(title = "Eurovsion voting network 2016",
caption = "Edges represent point allocations of six or more in the final contest") +
guides(size = FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment