Skip to content Skip to sidebar Skip to footer

I Can't Change The Line Thickness When Displaying The Graph

I have a dataset. I'm building a multigraph based on it. But I can't change the line thickness. dict_value={'Источник':[10301.0,10301.0,10301.0,10301.0,10329.0,10332.0,1033

Solution 1:

If you want to change edge thickness, add penwidth to your arguments

G = nx.MultiDiGraph() 
for row in session_graph.itertuples():
    if row[4]==1:
       G.add_edge(row[1], row[2],label=row[3],color="green",width=6, penwidth=6)
    if row[4]==3:
       G.add_edge(row[1], row[2],label=row[3],color="red",width=0.4, penwidth=1)
    if row[4]==4:
       G.add_edge(row[1], row[2],label=row[3],color="blue",width=0.4, penwidth=1)

If you draw your graph in dot format with you will see, that the problem is in GraphViz - it ignores weight argument but works with penwidth parameter, so you need to pass it to the drawing library. See Graphviz, changing the size of edge question for details.

Post a Comment for "I Can't Change The Line Thickness When Displaying The Graph"