Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing arrow size while keeping edge width intact #83

Open
Jojo6297 opened this issue Feb 8, 2024 · 3 comments
Open

Changing arrow size while keeping edge width intact #83

Jojo6297 opened this issue Feb 8, 2024 · 3 comments

Comments

@Jojo6297
Copy link

Jojo6297 commented Feb 8, 2024

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!

@paulbrodersen
Copy link
Owner

paulbrodersen commented Feb 8, 2024

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.

Figure_1

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.

@Jojo6297
Copy link
Author

Jojo6297 commented Feb 8, 2024

Thanks for the workaround, and a super cool network tool!

@paulbrodersen
Copy link
Owner

Thanks for the kind words!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants