-
Notifications
You must be signed in to change notification settings - Fork 38
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
Support for joining edges with bounding boxes of text labels of nodes #37
Comments
Hi, thanks for raising the issue and explaining in detail what you mean. I get it now. ;-)
Strictly speaking, even that would not be enough, as node artists can be triangles, for example. The more I think about it, the more it seems that we might want to emulate matplotlib's |
I've spent more time studying source code of I guess this functionality requires a lot of changes of current version. Could we expect them in the future versions of |
That is correct. Edges point to nodes, not the node labels. Netgraph supports placing node labels with an offset, i.e. outside of the node artist (/PathPatch), so pointing edges at node labels would not make much sense in the context of the rest of the code base. However, by default, iff the node labels are plotted centered on the node artists (i.e. without an offset), netgraph scales the font size of node labels such that all labels fit inside their node artists. Hence for me implementing this feature is equivalent to
I think you are imagining plotting the graph without any node artists and using the text bounding box as a node artist replacement. However, that would break pretty much everything else in the current code base (e.g. everything interactive), so any support for that will only ever be accidental.
If it is implemented the way that I am imagining it, I don't think it is too bad. I suspect almost all of the changes are isolated to _artists.py so the problem is quite self-contained.
Outside of _artists.py, I only expect minor changes in _main.py, specifically
That should be it, mostly?
It's fairly high on my netgraph todo list but I have a lot of work on my plate (of the type that pays bills) and my firstborn is due in a month. So if it doesn't happen in the next couple of weeks, it might be quite some time until I have enough head space to continue development on netgraph. |
On the
This should allow you to create rectangular nodes, that can then serve as text boxes. pip install https://github.com/paulbrodersen/netgraph/archive/dev.zip |
netgraph
doesn't support enclosing text labels in nodes and directing edges to the bounding boxes of text labels. At the current version nodes could be regular polygons or circles only.BaseGraph.draw_edges
method instantiatesedge_artist
that supports offset that is constant:node_size[target]
is a constant value. Hovewer, while creating bounding boxes of text labels, it would be nice to have a support for rectangular nodes that encloses text labels [1]. Also,netgraph
lacks support for dynamic recomputation of theoffset
while dragging source nodes in order to point arrows of edges to exact positions of bounding boxes of rectangles ot text labels (it should remain unique for each edge that points to the same node)[2]. Currently, it is able to point arrows only to specific offsets of each node that remains constant. I'm able to write code for both [1] and [2] and I can share it but I'm not sure if it's possible to allow each node artist to have attributes responsible for different height and width, notnode_size
only.The text was updated successfully, but these errors were encountered: