Retrieving node coordinates from ggraph network chart
问题 Let's say I produce this chart: library(ggraph) library(igraph) my_chart <- graph_from_data_frame(highschool) set.seed(2017) ggraph(my_chart, layout = "nicely") + geom_edge_link() + geom_node_point() How would one retrieve the x and y coordinates of the nodes from this chart? 回答1: Using ggplot_build library(ggraph) library(igraph) my_chart <- graph_from_data_frame(highschool) set.seed(2017) p <- ggraph(my_chart, layout = "nicely") + geom_edge_link() + geom_node_point() pg <- ggplot_build(p)