Matplotlib multigraph edges (undirected) filled#732
Conversation
|
So, please let me know if I understand this correctly:
Is my understanding correct? If it is, then I'm okay to merge this as a hotfix although I don't really like the trick with essentially drawing the edge twice. I wonder whether it would be possible to talk to the Matplotlib authors and mention this as a limitation. I see that there is a Another alternative solution for the future would be to draw the edges with one artist and the arrowheads with another artist. This still wouldn't solve the limitation of not being able to use different colors for different edges. All in all, I don't know how much time we should spend on tidying up the Matplotlib drawing backend in the current version. I think that maybe we should focus our efforts on designing a pluggable drawing backend API properly for the "new" Python interface with |
|
Hi @ntamas Correct. It's dirty but revealed a bunch of limitations in mol and hidden requirements from our end. I agree that we would start focusing on the new prototype, which is why I'm fine with a dirty design for this old version. I believe that you can change the color on a per edge basis but that's not central to the argument. Meeting up with mpl folks would be the logical next step. I can inquire with them to test the waters. |
|
Okay, happy to merge this as is then. |
|
Just to contextualize for future reference. The reason I rely on collections is that mpl collections have a mechanism to draw each element (e.g. a node marker) in figure points (or other units) and then shift it into position using data units (i.e. the layout coordinates). They roughly call it That does not exist for single elements. For instance, if we use a For edges it's even more tricky because we want to draw the line between two data coordinates minus an offset (the marker size) which is in figure points. This needs to be recomputed when you zoom in or out. I am going to reach out to mpl folks and ask them for a zoom meeting. |
Fixing #731.
I had it fixed and then took out a test to make it directed, and of course that failed to detect a regression. Now I fixed the bug and added a test for it, so it should be ok.
Notice I'm not really happy about the general solution, which involves retracing the edge twice, but mpl can be a little finnicky at times. I feel like from the lessons learned in our latest iteration of the plotting backend I could perhaps make one or two big PRs in mpl and improve the upstream behaviour. Anyway, a story for another day.
Ready to merge if it passes CI (it passes local tests on my machine already).