I am using networkx to draw a directed graph in Python. I use different widths of edges to highlight a weight. Unfortunately, the arrow heads are rounded which looks weird. I would like to draw non-rounded arrow heads for fat lines that look like a scaled version of the thin line arrows.
import networkx as nx
import matplotlib.pyplot as plt
import numpy
G=nx.DiGraph()
stake = [
[0, 1, 1, 3],
[3, 0, 0, 1],
[0, 0, 0, 1],
[1, 0, 3, 0]
]
maxS = max(max(stake))
stake1d = numpy.concatenate(stake)
minS = min(stake1d[numpy.nonzero(stake1d)])
minLineWeight = 1
maxLineWeight = 10
for x in range(len(stake)):
for y in range(x):
if(stake[x][y] > 0):
weight = (stake[x][y] - minS) / (maxS - minS) * (maxLineWeight - minLineWeight) + minLineWeight
G.add_edge(x, y, weight=weight, color='r')
for x in range(len(stake)):
for y in [i for i in range(len(stake))][-(len(stake)-x):]:
if(stake[x][y] > 0):
weight = (stake[x][y] - minS) / (maxS - minS) * (maxLineWeight - minLineWeight) + minLineWeight
G.add_edge(x, y, weight=weight, color='b')
weights=list(nx.get_edge_attributes(G,'weight').values())
colors=list(nx.get_edge_attributes(G,'color').values())
pos = nx.shell_layout(G)
nx.draw(
G,
pos=pos,
width=weights,
edge_color=colors,
with_labels=True,
arrows=True,
connectionstyle='arc3',
arrowstyle='->'
)
plt.show()

