özgür Sanli
özgür Sanli

Reputation: 81

Drawing an arrow with rotation just using coordinates of edges in python

I tried to draw an arrow between to coordinates but couldn't succeed.Let's say i got two points.Like coord1=(34,56) and coord2=(83,51) i need to draw an arrow between coord1 to coord2 but arrow must me angled.If i use just pyplot marker style ">" ,every arrow looks same, not angled. Then i find arrow guide from matplotlib here https://matplotlib.org/stable/gallery/shapes_and_collections/arrow_guide.html I change the numbers like what i want but i didn't work.Why?Or anyone knows how to draw an arrow with coordinate system.Thanks.

Upvotes: 0

Views: 1495

Answers (1)

Stef
Stef

Reputation: 30579

You can use annotate to draw an arrow:

fig,ax = plt.subplots()
ax.annotate('', xytext=(34, 56), xy=(83, 51), arrowprops=dict(arrowstyle='->'))
ax.set(xlim=(30, 90), ylim=(50, 60))

enter image description here

Upvotes: 1

Related Questions