I've tried tweaking the example here to facet on nodes instead of edges. But I'm getting the error:
Error in Ops.factor(self$layout$PANEL, i) :
level sets of factors are different
I'm sure I'm missing something obvious here?
library(ggraph)
library(tidygraph)
# Create graph of highschool friendships
graph <- as_tbl_graph(highschool) %>%
mutate(Popularity = centrality_degree(mode = 'in'))
# plot using ggraph
ggraph(graph, layout = 'kk') +
geom_edge_fan(aes(alpha = stat(index)), show.legend = FALSE) +
geom_node_point(aes(size = Popularity)) +
facet_nodes(~Popularity) +
theme_graph(foreground = 'steelblue', fg_text_colour = 'white')