-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question regarding circular layouts #256
Comments
Quite belated but can you share a plot or sketch that looks how you want it? |
There is no way to ensure that all edges goes to the center like in your example. Personally I also believe the behaviour you showed in the first post is much better as it avoids a lot of overplotting and is easier to read (I know biology has a thing for those arcs in the last plot but it is misguided) as for the angle of the node label that is easier to solve since ggraph provides a helper for this: gr <- create_notable('Meredith') %>%
mutate(class = sample(c('Class 1', 'Class 2', 'Class 3'), n(), replace = TRUE))
ggraph(gr, 'linear', circular = TRUE) +
geom_edge_arc(aes(alpha = after_stat(index)), strength = 0.2) +
geom_node_text(aes(label = class, angle = node_angle(x, y), hjust = x < 0)) +
coord_fixed(xlim = c(-1.2, 1.2), ylim = c(-1.2, 1.2)) As for the "arc-like" nodes this is not currently possible but I might be tempted to add this functionality to the linear layout |
Ok, With the latest changes I've added a weight argument to the linear layout to get uneven spacing of the nodes, plus the layout now returns enough information so that it can be used with ggraph(gr, 'linear', circular = TRUE, weight = sample(10, gorder(gr), T)) +
geom_edge_arc() +
geom_node_arc_bar(aes(r = 1.1)) +
coord_fixed(xlim = c(-1.2, 1.2), ylim = c(-1.2, 1.2)) I think this is as close I can get you :-) |
Hi,
This is a question about whether there is a better way of doing something in ggraph than the way I came up with a few years go by hacking ggforce.
The problem is to draw brain connectivity diagrams, with brain regions laid out in a circle according to an order I specify, and the angle each region subtends setable via a mapping - basically like the "amount" aesthetic in the ggforce pie chart. The ggforce solution was a hacked combination of the arc_bar and pie chart.
I was also able to place labels radiating from the centre with
I can get kind of close with point nodes sized according to the thing I'd like to map to angle subtended, and the edges are fine:
(Not reproducible, sorry)
I'd like to be able to have node label pointing outwards - (is there an appropriate angle being computed somewhere?), and also links going a bit closer to the centre, like the bezier option in ggforce.
It looks like the partition layout may be close, but requires a root node. Am I missing a more appropriate layout?
Thanks
The text was updated successfully, but these errors were encountered: