ggraph

Retrieving node coordinates from ggraph network chart

跟風遠走 提交于 2019-12-02 17:28:23
问题 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)

How to have “a” removed from a ggraph plot legend?

烈酒焚心 提交于 2019-12-01 03:38:45
Can the letter "a" be removed from the legend associated with e.g. a fill or colour aesthetic, in a ggraph network plot, like in the simple example below ? library(igraph) library(ggraph) g1 <- make_ring(6) vertex_attr(g1) <- list(name = LETTERS[1:6], type =rep(c("typeA", "typeB", "typeC"), 2)) ggraph(g1) + geom_node_label(aes(label = name, fill = type)) + geom_edge_diagonal() + theme_graph() In the case of geom_text , show.legend = FALSE solves it, Remove 'a' from legend when using aesthetics and geom_text but adding show.legend = FALSE within geom_node_label() , removes the legend completely

How to have “a” removed from a ggraph plot legend?

℡╲_俬逩灬. 提交于 2019-12-01 00:54:39
问题 Can the letter "a" be removed from the legend associated with e.g. a fill or colour aesthetic, in a ggraph network plot, like in the simple example below ? library(igraph) library(ggraph) g1 <- make_ring(6) vertex_attr(g1) <- list(name = LETTERS[1:6], type =rep(c("typeA", "typeB", "typeC"), 2)) ggraph(g1) + geom_node_label(aes(label = name, fill = type)) + geom_edge_diagonal() + theme_graph() In the case of geom_text , show.legend = FALSE solves it, Remove 'a' from legend when using