-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Description
Adding labels to geom_edge_parallel
causes some edges to collapse onto each other.
(Perhaps labels and parallel edges are not a great idea, but it could be nice to display two edges in opposing directions, instead of using arcs.)
Reprex:
library(ggraph)
library(tidygraph)
gr <- create_notable('bull') %>%
convert(to_directed) %>%
bind_edges(data.frame(from = c(1, 2, 2, 3), to = c(2, 1, 3, 2))) %E>%
mutate(class = sample(letters[1:3], 9, TRUE)) %N>%
mutate(class = sample(c('x', 'y'), 5, TRUE))
ggraph(gr, 'stress') +
geom_edge_parallel()
ggraph(gr, 'stress') +
geom_edge_parallel(
aes(label = 1),
angle_calc = 'along', label_dodge = grid::unit(20, 'points')
)
The first works fine:
But for the second (with labels), there are edges that are now on top of each other again.
(P.S.: You can also see that label_dodge
appears to be calculated from middle of the group of edges, and not each individual edge, but this may be difficult to fix.)