python - 带箭袋的 3D 矢量保持静态

标签 python matplotlib vector 3d

我得到了以下代码

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/

相关文章:

python - 如何让 Python ssl 模块使用内存中的数据而不是传递文件路径?

python - 在pandas和matplotlib中,为什么不直接在数据帧上调用plt?

python - Matplotlib:更改数学字体大小

c++ - 初始化具有动态长度的 vector

python - 字符串日期时间格式为 time() python 中的 unix 时间格式

python - 从 shell 输出中过滤特殊字符,例如颜色代码

python - 提取大字符串的部分

python - matplotlib图形水平轴标签自动对齐或重新缩放

c++ - 在 cpp 中使用 2d vector

vector - 如何将 3D 空间坐标转换为 2D 空间坐标?