如何在xaxis和yaxis上绘制matplotlib箭袋箭头?python

2024-04-28 12:34:30 发布

您现在位置:Python中文网/ 问答频道 /正文

目前,我用matplotlib绘制的图如图1所示,正如您在x轴上看到的,我的箭头的一半被该轴覆盖

我希望整个箭头如图2所示

这是我代码的相关部分,X_fine和Y_fine的范围与X和Y相同,但有更多的垃圾箱

X, Y = np.meshgrid(arrow_csf_centre, arrow_precip_centre)
X_fine, Y_fine = np.meshgrid(arrow_csf_centre_fine, arrow_precip_centre_fine)

plt.contourf(X_fine, Y_fine, np.transpose(counts2_fine), 30)
plt.quiver(X,
           Y,
           np.transpose(arrow_dirs[:,:,0]),
           np.transpose(arrow_dirs[:,:,1]), 
           angles='xy', 
           scale_units='xy',
           scale=1,
           pivot='mid')

谢谢你的阅读

图1-我的情节Figure 1 - my plot

图2-目标图 enter image description here


Tags: matplotlibnp绘制plt箭头dirstransposescale