ggraph

Repel text from edges in network

柔情痞子 提交于 2021-02-18 22:23:06
问题 When drawing a network, it would be nice if the labels of the nodes could also avoid network edges. E.g. in the example below, it would be possible to move all the labels outside the network. I've tried several packages, but so far have not found even a hacky way to do that. Is there a way? Example below: library(ggraph) library(tidygraph) reprex <- tibble(to = sample(1:10, 100,replace=T), from = sample(1:10, 100,replace=T) ) %>% as_tbl_graph() V(reprex)$label1 <- rep("label",10) reprex_plot

ggraph network plot: specify node coordinates

北战南征 提交于 2021-02-10 08:14:54
问题 Trying to plot a network with the ggraph package and specify the coordinates of each node. While I can implement this with the igraph package - I cannot do this with the ggraph package. # reproducible example to generate a random graph library(igraph) g1 <- erdos.renyi.game(20, 1/2) plot(g1) # function to produce coordinates for each node in order of the node # degree (number of links per node) coord <- function(g){ n.nod <- length(V(g)) mat.c <- matrix(0, nrow = n.nod, ncol = 2) deg <-

ggraph network plot: specify node coordinates

走远了吗. 提交于 2021-02-10 08:14:54
问题 Trying to plot a network with the ggraph package and specify the coordinates of each node. While I can implement this with the igraph package - I cannot do this with the ggraph package. # reproducible example to generate a random graph library(igraph) g1 <- erdos.renyi.game(20, 1/2) plot(g1) # function to produce coordinates for each node in order of the node # degree (number of links per node) coord <- function(g){ n.nod <- length(V(g)) mat.c <- matrix(0, nrow = n.nod, ncol = 2) deg <-

ggraph network plot: specify node coordinates

梦想的初衷 提交于 2021-02-10 08:13:04
问题 Trying to plot a network with the ggraph package and specify the coordinates of each node. While I can implement this with the igraph package - I cannot do this with the ggraph package. # reproducible example to generate a random graph library(igraph) g1 <- erdos.renyi.game(20, 1/2) plot(g1) # function to produce coordinates for each node in order of the node # degree (number of links per node) coord <- function(g){ n.nod <- length(V(g)) mat.c <- matrix(0, nrow = n.nod, ncol = 2) deg <-

ggraph network plot: specify node coordinates

南楼画角 提交于 2021-02-10 08:12:31
问题 Trying to plot a network with the ggraph package and specify the coordinates of each node. While I can implement this with the igraph package - I cannot do this with the ggraph package. # reproducible example to generate a random graph library(igraph) g1 <- erdos.renyi.game(20, 1/2) plot(g1) # function to produce coordinates for each node in order of the node # degree (number of links per node) coord <- function(g){ n.nod <- length(V(g)) mat.c <- matrix(0, nrow = n.nod, ncol = 2) deg <-

ggraph network plot: specify node coordinates

人走茶凉 提交于 2021-02-10 08:11:44
问题 Trying to plot a network with the ggraph package and specify the coordinates of each node. While I can implement this with the igraph package - I cannot do this with the ggraph package. # reproducible example to generate a random graph library(igraph) g1 <- erdos.renyi.game(20, 1/2) plot(g1) # function to produce coordinates for each node in order of the node # degree (number of links per node) coord <- function(g){ n.nod <- length(V(g)) mat.c <- matrix(0, nrow = n.nod, ncol = 2) deg <-

ggraph network plot: specify node coordinates

旧街凉风 提交于 2021-02-10 08:11:16
问题 Trying to plot a network with the ggraph package and specify the coordinates of each node. While I can implement this with the igraph package - I cannot do this with the ggraph package. # reproducible example to generate a random graph library(igraph) g1 <- erdos.renyi.game(20, 1/2) plot(g1) # function to produce coordinates for each node in order of the node # degree (number of links per node) coord <- function(g){ n.nod <- length(V(g)) mat.c <- matrix(0, nrow = n.nod, ncol = 2) deg <-