I have gotten a great graph by two distinct electrodes with the following code:
elec <- c("Fp1","Fp2","F7","F3","Fz","F4","F8","FC5","FC1","FC2","FC6","C3","Cz","C4","CP5","CP1","CP2","CP6","P7","P3","Pz","P4","P8","POz","Oz",
"Fp1","Fp2","F7","F3","Fz","F4","F8","FC5","FC1","FC2","FC6","C3","Cz","C4","CP5","CP1","CP2","CP6","P7","P3","Pz","P4","P8","POz","Oz")
edgelist <- get.edgelist(net)
# get vertex labels
label <- get.vertex.attribute(net, "name")
# get vertex groups
group <- get.vertex.attribute(net, "group")
# get vertex fill color
fill <- get.vertex.attribute(net, "color")
# get family
family <- get.vertex.attribute(net, "family")
# get vertex degree
degrees <- degree(net)
# data frame with groups, degree, labels and id
nodes <- data.frame(group, degrees, family, label, fill, id=1:vcount(net))
nodes$family <- factor(nodes$family, levels = unique(nodes$family))
nodes$label <- factor(nodes$label, levels = unique(nodes$label))
nodes <- as_tibble(nodes)
# prepare data for edges
edges <- as_tibble(edgelist)
net.tidy <- tbl_graph(nodes = nodes, edges = edges, directed = TRUE, node_key = "label")
ggraph(net.tidy, layout = "linear") +
geom_edge_arc(alpha = 0.5) +
scale_edge_width(range = c(0.2, 2)) +
scale_colour_manual(values= vrtxc) +
geom_node_point(aes(size = degrees, color = family)) +
geom_node_text(aes(label = elec), angle = 90, hjust = 1, nudge_y = -0.5, size = 3) +
coord_cartesian(clip = "off") +
theme_graph()+
theme(legend.position = "top")
And I got a great graph that I like.
However, I would like to separate both sets of electrodes, in the middle, where Oz is, a little bit, to see there is a difference. In the node attributes I have them differentiated by group (1,2), and I would like to know whether this information could be used to expand through the x axis both sets of vertices, on set of 25 electrodes to the left, the other one to the right of the axis, leaving a space in the middle of them.
I attach some look at the data in case its useful
> nodes
# A tibble: 50 x 6
group degrees family label fill id
<fct> <dbl> <fct> <fct> <fct> <int>
1 1 5 fronp Fp1_1 #3B9AB2 1
2 1 9 fronp Fp2_1 #3B9AB2 2
3 1 6 fron F7_1 #5DAABC 3
4 1 7 fron F3_1 #5DAABC 4
5 1 11 fron Fz_1 #5DAABC 5
6 1 9 fron F4_1 #5DAABC 6
7 1 11 fron F8_1 #5DAABC 7
8 1 8 fronc FC5_1 #88BAAE 8
9 1 6 fronc FC1_1 #88BAAE 9
10 1 4 fronc FC2_1 #88BAAE 10
# … with 40 more rows
In case someone is interested, I ended up inserting some dummy rows in the nodes
dataframe and it did the trick.