Displaying arrows associated to edges in directed graphs

1,915 views
Skip to first unread message

giorgiog

unread,
Apr 27, 2015, 10:19:56 AM4/27/15
to networkx...@googlegroups.com
Hi,

I would obtain a more evident graphical representation of the arrows in graph edges.

This is what I currently use:

    pos=nx.circular_layout(G)
    nx.draw_networkx_nodes(G,pos,node_size=6000,node_color='y')
    nx.draw_networkx_labels(G, pos, labels, font_size=11)
    nx.draw_networkx_edge_labels(G, pos, edge_labels=edge_labels)                        
    nx.draw_networkx_edges(G, pos, edge_color='b', alpha = 0.5, arrows=True)
    plt.show()

However I do not like very much how arrows are plotted.

Please, any suggestions ? Thanks

Giorgio

Aric Hagberg

unread,
Apr 27, 2015, 10:22:47 AM4/27/15
to networkx...@googlegroups.com
Hi Giorgio - Unfortunately there is no better way so far to draw
arrows with NetworkX/Matplotlib.
You might try using graphviz (graphviz.org) which makes beautiful
directed graph drawings. You can create a "dot" file suitable for
input to graphviz with networkx.write_dot(G,filename).

Aric
> --
> You received this message because you are subscribed to the Google Groups
> "networkx-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to networkx-discu...@googlegroups.com.
> To post to this group, send email to networkx...@googlegroups.com.
> Visit this group at http://groups.google.com/group/networkx-discuss.
> For more options, visit https://groups.google.com/d/optout.

giorgiog

unread,
Apr 27, 2015, 10:32:06 AM4/27/15
to networkx...@googlegroups.com
Thanks. Anyway, I improved a little bit by taking advantage of the width parameter:

nx.draw_networkx_edges(G, pos, edge_color='b', alpha = 0.5, width=3, arrows=True)
Reply all
Reply to author
Forward
0 new messages