Skip to content

Instantly share code, notes, and snippets.

@chichacha
Created November 23, 2019 01:31
Show Gist options
  • Save chichacha/5c5a2739dd1abf806fdcafdbc362432c to your computer and use it in GitHub Desktop.
Save chichacha/5c5a2739dd1abf806fdcafdbc362432c to your computer and use it in GitHub Desktop.
Norman Bates Characters
bates <- "https://query.data.world/s/v33quww65lxp73uweh2wldvom4tbe2"
bates <- read_csv(bates)
library(tidygraph)
library(ggraph)
bates_gg <-tbl_graph(edges=bates, directed=F) %>%
mutate(deg=centrality_degree(),
test=centrality_betweenness())
bates_gg %>%
ggraph(layout="stress") +
geom_edge_link(aes(edge_color=relationship), alpha=0.8) +
geom_node_point(aes(size=deg), alpha=0.1) +
geom_node_text(aes(label=name, size=test), family="Roboto Condensed") +
theme_graph() +
scale_size_continuous(range=c(3,10), guide="none") +
scale_edge_color_manual(values=colorRampPalette(ggthemes::tableau_color_pal("Hue Circle")(19))(100), guide="none")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment