簡體   English   中英

plot matplotlib 如何在 x 軸和 y 軸上顫動箭頭? - Python

[英]How to plot matplotlib quiver arrows over x-axis and y-axis? - Python

目前我用 matplotlib 制成的 plot 看起來像圖 1,正如您在 x 軸上看到的那樣,我的箭頭的一半被軸覆蓋。

我想要它,所以整個箭頭如圖 2 所示。

這是我的代碼的相關部分,X_fine 和 Y_fine 與 X 和 Y 具有相同的范圍,但具有更多的 bin。

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 - 我的 plot 圖 1 - 我的情節

圖2-目標plot 在此處輸入圖像描述

您可以在plt.quiver中添加: clip_on=False

這應該這樣做。

相關: 如何讓我的 matplotlib plot go 超出軸?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM