I'm really new to networkX but I'be been playing with it for a bit and
getting some good results. I have a network that I plot with colours
based on the pvalue associated with an expression value - is there any
way to add a colourbar, or a legend to the plot to show the range pf
pvalues displayed?
Nick
Check out:
matplotlib.pyplot.colorbar()
http://matplotlib.sourceforge.net/api/
pyplot_api.html#matplotlib.pyplot.colorbar
That page has a lot of other nice drawing capabilities for matplotlib
that you will enjoy exploring. :) Since NetworkX uses matplotlib
any of them should work with your project.
Dan
> --
> You received this message because you are subscribed to the Google
> Groups "networkx-discuss" group.
> To post to this group, send email to networkx-
> dis...@googlegroups.com.
> To unsubscribe from this group, send email to networkx-discuss
> +unsub...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/
> group/networkx-discuss?hl=en.
>
That is the reason. With a little more work you can control which
colorbar (you can even have 2). e.g.
import matplotlib.pyplot as plt
import networkx as nx
G=nx.star_graph(20)
pos=nx.spring_layout(G)
node_colors=range(21)
edge_colors=range(20)
nodes=nx.draw_networkx_nodes(G,pos,node_color=node_colors,cmap=plt.cm.Reds)
edges=nx.draw_networkx_edges(G,pos,edge_color=edge_colors,width=4,edge_cmap=plt.cm.Blues)
plt.sci(nodes)
plt.colorbar()
plt.sci(edges)
plt.colorbar()
plt.show() # display
Aric
On 22 Feb, 14:32, Aric Hagberg <ahagb...@gmail.com> wrote: