Reputation: 165
Is it possible to plot weighted graphs
in python using matplotlib?. I did not find it on the matplotlib website.
if I can't do it using matplotlib
, can I do it using something else?
can we do it on libreoffice
?
essentially this is how my data looks like.
a,b,5
b,c,10
a,c,7
Upvotes: 3
Views: 4021
Reputation: 165
Got the answer: The link points us an answer given by William Stein
. all credits to him.
Here is the answer:
Try Sage - it's open source and can draw weighted directed graphs. 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
Here is another given in the same page by : Nick Loughlin
Try Graphviz - it's open source and quite flexible as far as usage is concerned.
It's good at automatic layouts etc, where for example Maple would make a mess of things.
Upvotes: 2