ggforce

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 <-

Aligning ggrepel labels

笑着哭i 提交于 2020-07-20 03:46:40
问题 I have a script that downloads a bunch of COVID data about the area surrounding some Air Force bases and produces a chart. I was going to try to reproduce it using a big dput() but it's too many characters for a post. The dput() to reproduce the data frame can be copied from here. The data itself looks like head(smDailyBaseData) DaysSince Base abbv newRate label <drtn> <chr> <chr> <dbl> <chr> 1 7 days Edwards EdwardsAFB 0 "Edwards \n 0" 2 8 days Edwards EdwardsAFB 0.00000140 "Edwards \n 2" 3

Aligning ggrepel labels

扶醉桌前 提交于 2020-07-20 03:46:05
问题 I have a script that downloads a bunch of COVID data about the area surrounding some Air Force bases and produces a chart. I was going to try to reproduce it using a big dput() but it's too many characters for a post. The dput() to reproduce the data frame can be copied from here. The data itself looks like head(smDailyBaseData) DaysSince Base abbv newRate label <drtn> <chr> <chr> <dbl> <chr> 1 7 days Edwards EdwardsAFB 0 "Edwards \n 0" 2 8 days Edwards EdwardsAFB 0.00000140 "Edwards \n 2" 3

ggforce facet_zoom - labels only on zoomed example

元气小坏坏 提交于 2020-01-15 03:23:40
问题 I would like to label points in a scatterplot, but only those within the facet_zoom panel. Here is an example: library(ggplot2) library(ggforce) library(ggrepel) library(magrittr) labels <- letters example_values_x <- rnorm(26) example_values_y <- rnorm(26) df <- data.frame(labels, example_values_x, example_values_y) df %>% ggplot(aes(y = example_values_y, x = example_values_x)) + geom_point() + facet_zoom(x = example_values_x > 0.5) + geom_label_repel(data = filter(df, example_values_x > 0.5

ggforce facet_zoom - labels only on zoomed example

有些话、适合烂在心里 提交于 2020-01-15 03:23:05
问题 I would like to label points in a scatterplot, but only those within the facet_zoom panel. Here is an example: library(ggplot2) library(ggforce) library(ggrepel) library(magrittr) labels <- letters example_values_x <- rnorm(26) example_values_y <- rnorm(26) df <- data.frame(labels, example_values_x, example_values_y) df %>% ggplot(aes(y = example_values_y, x = example_values_x)) + geom_point() + facet_zoom(x = example_values_x > 0.5) + geom_label_repel(data = filter(df, example_values_x > 0.5