netgraph
netgraph copied to clipboard
Changing arrow size while keeping edge width intact
Dear authors,
Is there a way to change the arrow size of the directed edges, while keeping the edge width intact? I tried to add in edge_kwargs = dict(arrow_size = arrow_size), but it doesn't work.
Thanks!
It's not a feature that is properly supported but it can be done by instantiating the Graph object (or any of the derived classes), and then manipulating each edge artist individually.
import matplotlib.pyplot as plt
from netgraph import Graph
fig, ax = plt.subplots()
g = Graph([(0, 1), (1, 2), (2, 0)], arrows=True, node_labels=True, ax=ax)
edge_artist = g.edge_artists[(0, 1)]
edge_artist.head_width = 0.05
edge_artist.head_length = 0.1
edge_artist._update_path()
plt.show()
You are not the only that is wanting to get fancy with arrows (see issue #82), so I will try it to come up with proper way for the next release. However, as there is no "authors", just me, this will still be a while.
Thanks for the workaround, and a super cool network tool!
Thanks for the kind words!