python箭头变换_如何在Matplotlib中旋转花式箭头

如何旋转Matplotlib中的花式箭头(我不想制作动画),我尝试了旋转和变换,它们都不适合我,我想,我犯了一些错误,请提供任何帮助或其他解决方案,我已经粘贴了我的代码如下。在import matplotlib.pyplot as plt

fig, ax = plt.subplots()

#Arrow in degree

#Arrow represent the wind direction

degree= 45 #Arrow should rotate as per the specified degree, (0 degree is North)

#Draw Circle

#CENTER POINT

Circle1 = plt.Circle((5, 5), 0.1, color='blue', fill=True)

ax.add_artist(Circle1)

#CIRCLE

Circle2 = plt.Circle((5, 5), 6, color='blue', fill=False)

ax.add_artist(Circle2)

x3=5.0

y3=6.8

x4=5.0

y4=9.0

#Wind Direction Arrow

#LEFT ARROW

ax.annotate('',

xy=(x3-0.5, y3), xycoords='data',

xytext=(-20, 50), textcoords='offset points', rotation=degree,

size=20,

# bbox=dict(boxstyle="round", fc="0.8"),

arrowprops=dict(arrowstyle="fancy",

fc="0.6", ec="none",

connectionstyle="angle3,angleA=0,angleB=-90"))

#CENTER ARROW

ax.annotate('',

xy=(x3, y3), xycoords='data',

xytext=(0, 50), textcoords='offset points', rotation=degree,

size=20,

# bbox=dict(boxstyle="round", fc="0.8"),

arrowprops=dict(arrowstyle="fancy",

fc="0.6", ec="none",

connectionstyle="angle3,angleA=0,angleB=-90"))

#RIGHT ARROW

ax.annotate('',

xy=(x3+0.5, y3), xycoords='data',

xytext=(20, 50), textcoords='offset points', rotation=degree,

size=20,

# bbox=dict(boxstyle="round", fc="0.8"),

arrowprops=dict(arrowstyle="fancy",

fc="0.6", ec="none",

connectionstyle="angle3,angleA=0,angleB=-90"))

ax.set_aspect('equal')

ax.set_xlim([-2.5,12.5])

ax.set_ylim([-3,15])

plt.show()

代码结果。

a3fd157424eefdbe37d3bf1a0be611ba.png

我的要求:

所有3个箭头(代表风向的箭头)都应旋转到指定的角度,保持中心点为锚。在

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值