Python - matplotlib - weighted plots

Is it possible to plot weighted graphs

in python using matplotlib ?. I didn't find it on the matplotlib site.

If I can't do it with matplotlib

, can I do it using something else? can we do it on libreoffice

?

This is essentially what my data looks like.

a,b,5
b,c,10
a,c,7

      

+3


source to share


1 answer


Received an answer: the link points us to the answer given William Stein

. all credits to him.

Here's the answer:

Try Sage - it's open source and can draw weighted oriented plots. For example:

A = random_matrix(ZZ,6, density=0.5)
G = DiGraph(A, format='weighted_adjacency_matrix')  # graph from matrix
H = G.plot(edge_labels=True, graph_border=True)
H.show()             # display on screen
H.save('graph.pdf')  # save plot to vector pdf for inclusion in a paper

      



Below is the other mentioned on the same page: Nick Loughlin

Try Graphviz - it's open source and quite flexible as far as usage goes.

This is good for auto layouts, etc. where Maple, for example, will create a mess.

+2


source







All Articles