Embedded nodes in draw_multilayer#612
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
Quoting @thomasrobiglio :
Yes, I thought that might be a problem. Matplotlib has different types of collections, including a PatchCollection with an example here. Would this work with the 3D patches? |
|
Thank you @maximelucas! this is more or less the documentation I was looking at when working on this... let's see if I can find something that works :). |
|
This could be a way out... to have the circles for the nodes drawn as polygons with many sides. It's not the best thing to do, but I could not find a way to use a collection of circle objects in 3d. With a couple of tweaks, I should be able to make it work from outside as the function we have in the stable version now. |
|
Could you show us what the viz would look like? Is it like your example in the issue you opened? |
|
@thomasrobiglio nice, even if we view it from above? Do you think the colors of the nodes are still visible enough (for example when we plot stats)? |
|
thanks for the ping @maximelucas! tbh this had fallen into oblivion on my to-do list... I'll try to make some further progress |
|
Apparently you could do something like this instead: # one Circle per node per layer
patches = [Circle((x, y), radius) for ... ]
node_collection = PatchCollection(
patches,
array=node_fc_arr, # values → mapped by the collection (enables colorbar)
cmap=node_fc_cmap,
edgecolors=node_ec,
linewidths=node_lw,
)
art3d.patch_collection_2d_to_3d(node_collection, zs=z_per_patch, zdir="z",
depthshade=False) # keep stat colors faithful
ax.add_collection3d(node_collection)Pros compared to current PR solution:
Worth having a look |

Adresses #436. I am still working on this to try to change as little as possible to behavior of the function.