简体   繁体   English

plot matplotlib 如何在 x 轴和 y 轴上颤动箭头? - Python

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

Currently my plot made with matplotlib looks like figure 1, as you can see on the x-axis, the half of my arrow is being covered by the axis.目前我用 matplotlib 制成的 plot 看起来像图 1,正如您在 x 轴上看到的那样,我的箭头的一半被轴覆盖。

I would like it so the entire arrow is shown as in Figure 2.我想要它,所以整个箭头如图 2 所示。

Here is the relevant part of my code, X_fine and Y_fine have same range as X and Y but with more bins.这是我的代码的相关部分,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')

Thanks for reading!谢谢阅读!

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

Figure2 - goal plot图2-目标plot 在此处输入图像描述

You can add: clip_on=False in plt.quiver您可以在plt.quiver中添加: clip_on=False

This should do it.这应该这样做。

Related: How do I let my matplotlib plot go beyond the axes?相关: 如何让我的 matplotlib plot go 超出轴?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Plot 具有不同的 x 轴和 y 轴使用 matplotlib - Plot with different x-axis and y-axis using matplotlib 在日志中修复 x 轴和 y 轴 plot python - Fixing x-axis and y-axis in a log plot python 如何在matplotlib中均衡x轴和y轴的比例? - How to equalize the scales of x-axis and y-axis in matplotlib? 如何使用 plot 在 x 轴上循环变量 i 和在 y 轴上循环中的局部变量使用 matplotlib - How to plot loop variable i on x-axis and local variable in the loop on y-axis using matplotlib 如何使plot的x轴原点和y轴原点在matplotlib中重叠? - How can I make the origin of the x-axis and the origin of the y-axis of a plot overlap in matplotlib? 如何在y轴上绘制日期,在x轴上绘制小时? - How to plot date on y-axis and hours on x-axis? 如何在 python 中以像素数为 x 轴,灰度颜色为 y 轴 plot 图形? - How can I plot the figure with the number of pixel as a x-axis and the grayscale color as a y-axis in python? matplotlib 从 x 轴而不是 y 轴绘制累积图 - matplotlib plot on cumulative graph from x-axis instead of y-axis 在 matplotlib 中使用两个 y 轴格式化 x 轴标签(条形图和折线图) - formatting x-axis labels with two y-axis in matplotlib (bar and line plot) 如何在matplotlib中反转y轴以与x轴共享一个共同的原点以用于3D绘图? - How to get y-axis inverted to share a common original point with x-axis for 3D plot in matplotlib?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM