Hello,
I am playing around with ggraph and would like to know if there is a way to globally (or manually) change the size of the circular layout beyond x/y = -1 and +1, to say x/y = -2 and +2.
Thank you!
# code based on this tutorial: https://www.jessesadler.com/post/network-analysis-with-r/
library(tidyverse)
library(tidygraph)
library(ggraph)
nodesList <- tibble(
id = 1:12,
label = c("Altered State", "Rationality", "Positive Affect",
"Arousal", "Self Awareness", "Memory",
"Inward \n Absorbed \n Attention", "Negative Affect",
"Altered Experience", "Volitional Control",
"Vivid Imagery", "Internal Dialogue")
)
edgeList <- tibble(
from = c(1, 1, 2, 2, 2, 2, 3, 5, 8, 11),
to = c(9, 10, 5, 6, 10, 11, 11, 6, 12, 12),
weight = c(21, -23, 16, 14, 14, 14, 40, 16, 11, 11)
)
routesTidy <- tbl_graph(nodes = nodesList, edges = edgeList, directed = TRUE)
class(routesTidy)
routesTidy
ggraph(routesTidy, layout = 'linear', circular = TRUE) +
geom_edge_link(aes(width = weight), alpha = 0.6) +
scale_edge_width(range = c(0.4, 4)) +
geom_node_point(aes(color = as.factor(id)), size = 15) +
#theme_graph() +
#geom_node_point(size = 15) +
geom_node_text(aes(label = label), repel = TRUE,
nudge_x = .03, nudge_y = 0.15) +
coord_fixed(ratio = 1) #xlim = c(-2,2), ylim = c(-2, 2)