简体   繁体   English

颤抖的3D向量保持静态

[英]3D vector with quiver remains static

I got the following code 我得到以下代码

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()

Running this never changes the length of the vector in the x-direction. 运行它永远不会改变向量在x方向上的长度。 It seems to be stuck by 1. Any idea how I could draw the vector r = (10,0,0)? 似乎被1所卡住了。我知道如何绘制向量r =(10,0,0)吗? I also tried to use scale, scale_units, and angles but without success. 我也尝试使用scale,scale_units和angles,但没有成功。 It just kept on complaining that these attributes do not exist. 它只是不断抱怨这些属性不存在。 FYI, this is only a MWE. 仅供参考,这只是MWE。

This has been fixed three years ago via https://github.com/matplotlib/matplotlib/pull/5458 , which means it'll work as expected in matplotlib >= 2.0. 这已在三年前通过https://github.com/matplotlib/matplotlib/pull/5458修复,这意味着它将在matplotlib> = 2.0中按预期工作。
Also see API changes in 2.0 where it says 另请参阅2.0中的API更改 ,内容如下:

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. 3D颤动功能以前将箭头标准化为相同的长度,这使得它在箭头应为不同长度且与2D功能的行为不匹配的情况下无法使用。 This normalization behavior is now controlled with the normalize keyword, which defaults to False. 现在,此归一化行为由normalize关键字控制,该关键字默认为False。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM