由于箭头的头和尾是在不同的坐标系中指定的,因此我似乎唯一的选择是围绕圆心分别旋转坐标。
import numpy as npimport matplotlib.pyplot as pltimport matplotlib.transforms as mtransfig, ax = plt.subplots()#Arrow represent the wind direction#Arrow should rotate as per the specified degree, (0 degree is North)x3=5.0y3=5.0#Draw Circle#CENTER POINTCircle1 = plt.Circle((x3, y3), 0.1, color='blue', fill=True)ax.add_artist(Circle1)#CIRCLECircle2 = plt.Circle((x3, y3), 6, color='blue', fill=False)ax.add_artist(Circle2)def winddirectionarrow(ax, xy, deg): m1 = np.array( (-1, 1) ) m2 = np.array( (0, 1) ) s1 = np.array( (0.5, 1.8) ) s2 = np.array( (20, 50) ) xy = np.array(xy) rot = mtrans.Affine2D().rotate_deg(deg) #Wind Direction Arrow cncs = "angle3,angleA={},angleB={}".format(deg,deg-90) kw = dict(xycoords='data',textcoords='offset points',size=20, arrowprops=dict(arrow, fc="0.6", ec="none", connectionstyle=cncs)) #LEFT ARROW ax.annotate('', xy=xy + rot.transform_point(m1*s1), xytext=rot.transform_point(m1*s2), **kw) #CENTER ARROW ax.annotate('', xy=xy + rot.transform_point(m2*s1), xytext=rot.transform_point(m2*s2), **kw) #RIGHT ARROW ax.annotate('', xy=xy + rot.transform_point(s1), xytext=rot.transform_point(s2), **kw)winddirectionarrow(ax, (x3,y3), 45)winddirectionarrow(ax, (x3,y3), -60)winddirectionarrow(ax, (x3,y3), 170)ax.set_aspect('equal') ax.set_xlim([-2.5,12.5])ax.set_ylim([-3,15])plt.show()


