-
Notifications
You must be signed in to change notification settings - Fork 33
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
easy colorbar plotting #437
Comments
A bit of theory after some digging to see what's the natural of doing this:
How much do we want from this implementation?
Potential implementations for the node colours:
Solution 2 seems the most natural to me. I've tried this by making
Visually, running fig, ax = plt.subplots()
pos = xgi.circular_layout(H)
ax, im = xgi.draw(H, pos=pos, ax=ax, node_fc=H.nodes.degree, node_fc_cmap=plt.cm.Greens)
plt.colorbar(im) yields This is because solution 2 requires to pass So my question is: are we not over-complicating things with |
I've started a draft PR #441 so you can see what I tried. |
Update: networkx seems to only be using And G = nx.gnp_random_graph(n=10, p=0.3)
im = nx.draw_networkx_nodes(G, node_color=np.random.random(len(G)), pos=nx.circular_layout(G))
plt.colorbar(im) This also allows to use cmap names instead of the actual object: so far for us only |
Add an easy way to plot a colorbar when coloring nodes by a stat.
Right now, in networkx is pretty convoluted to do it, see: https://stackoverflow.com/questions/26739248/how-to-add-a-simple-colorbar-to-a-network-graph-plot-in-python
The text was updated successfully, but these errors were encountered: