我得到了以下代码
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.quiver(0,0,0,10, 0, 0, pivot='tail')
ax.set_xlim3d(-2, 5)
ax.set_ylim3d(-2, 2)
ax.set_zlim3d(-2, 2)
plt.grid()
plt.draw()
plt.show()
运行此命令不会改变向量在 x 方向上的长度。它似乎被 1 困住了。知道如何绘制向量 r = (10,0,0) 吗? 我还尝试使用比例、比例单位和角度,但没有成功。它只是一直提示这些属性不存在。 仅供引用,这只是一个 MWE。
最佳答案
这个问题已于三年前通过 https://github.com/matplotlib/matplotlib/pull/5458 修复。 ,这意味着它将在 matplotlib >= 2.0 中按预期工作。
另请参阅API changes in 2.0它说的地方
The 3D quiver function previously normalized the arrows to be the same length, which makes it unusable for situations where the arrows should be different lengths and does not match the behavior of the 2D function. This normalization behavior is now controlled with the normalize keyword, which defaults to False.
关于python - 带箭袋的 3D 矢量保持静态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52799030/