-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add one label to multiple edges #45
Comments
Your last question implies that you control the node positions manual anyway so I'd suggest to use Makie directly for this, i.e. use You could also set some labels to |
For something more generic you could extract the paths which represent the edges. Using those you can interpolate positions along the edges as well as the tangent of the edge. That's how we determine the elabel positions and rotations internally. This data might be useful to calculate the position where you want to place your combined label. using GLMakie, GraphMakie, Graphs
g = complete_graph(5)
fig, ax, p = graphplot(g)
# extract list of drawn curves for the edges
edgepaths = p.plots[1][:paths][]
# calculate position and tangent vectors along those lines where t in 0..1
t = 0.2
GraphMakie.interpolate(edgepaths[1], t)
# 2-element Point{2, Float32} with indices SOneTo(2):
# -1.1051269
# -0.36803403
GraphMakie.tangent(edgepaths[1], t)
# 2-element Point{2, Float32} with indices SOneTo(2):
# 0.42698735
# -0.90425766 |
Thanks, I'll have a deeper look if I can make it work with the tangents solution that you offered. In the meantime I've implemented the simple heuristic I've outlined in my initial post. |
I have multiple edges that shall have the same label. Instead of repeatedly displaying the label for each of the edges, is it possible to show only one label for all of them together?
Example from the docs:
I might want to remove the labels 3, 2 and 8 and only show a label "top side" that is positioned in the middle (distance-wise) of the three edges.
I assume that this would only be possible if we provide a list of those nodes that belong to each other (e.g.
[2,3,8]
in the example above). Assuming we have such a list, would it then be possible to display a combined label for all three edges?Approaching this in a naive way, I would just set the label of edges 3 and 8 to
""
and the label of edge 2 to"top side"
. This isn't really a good solution though because it wouldn't necessarily place the label in the middle along the three edges and also wouldn't work for even numbers of edges.The text was updated successfully, but these errors were encountered: