You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to facet my graph after bind_graph(). The two networks I am binding have different sets of edges: a first one only includes edges from a specific node, the second only includes edges directed to that node.
When I plot the graph, I obtain the two cloud with no isolates. When I use the facet_edges() option, I obtain the two clouds in distinct panes, but now they both include the unconnected nodes from the other graph.
I tried to solve the issue, but I could not find how.
My code is
I am trying to facet my graph after bind_graph(). The two networks I am binding have different sets of edges: a first one only includes edges from a specific node, the second only includes edges directed to that node.
When I plot the graph, I obtain the two cloud with no isolates. When I use the facet_edges() option, I obtain the two clouds in distinct panes, but now they both include the unconnected nodes from the other graph.
I tried to solve the issue, but I could not find how.
My code is
`
Overall network
g.tot.1 <- tbl_graph(nodes = nodes, edges = fdi) %>%
activate(edges) %>% filter(sector == 'Financial Services') %>%
activate(nodes) %>% filter(!node_is_isolated()) %>%
activate(edges) %>% mutate(tofrom = ifelse(.N()$name[to] == 'DUB', 1, 2))
incoming edges
g.to.1 <- g.tot.1 %>%
filter(tofrom == 1) %>%
activate(nodes) %>% filter(!node_is_isolated())
outgoing edges
g.from.1 <- g.tot.1 %>%
filter(tofrom == 2) %>%
activate(nodes) %>% filter(!node_is_isolated())
Plot
g <- g.to.1 %>% bind_graphs(g.from.1) %>% activate(nodes) %>% filter(!node_is_isolated())
ggraph(g, layout = 'fr') +
facet_edges(~tofrom) +
geom_edge_link() +
geom_node_point(size = 5, colour = "steelblue") +
geom_node_text(aes(label = name), colour = 'black', vjust = 0.4) +
ggtitle('FDI From and To Dubai', subtitle = "Financial Sevices") +
theme_graph(foreground = 'steelblue')
`
The text was updated successfully, but these errors were encountered: