【发布时间】:2019-03-18 20:04:21
【问题描述】:
我得到以下代码
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) 吗? 我也尝试使用 scale、scale_units 和 Angles,但没有成功。它只是不断抱怨这些属性不存在。 仅供参考,这只是一个 MWE。
【问题讨论】:
-
运行您的代码时,我看到this image。由于选择了 xlim,箭头被切断。但是可以看到它会上升到 10。我猜选择其他限制,例如
ax.set_xlim3d(-2, 12)会更有用。 -
我只是在玩极限。不影响结果。
-
那我觉得我没听懂这个问题。
-
当我改变向量在x中的结束位置时,它总是绘制一个以1结尾的向量。
-
这很不幸,但在我运行代码时不会发生(如上面链接的图片所示)。因此,您将需要提供更多信息,例如您正在使用什么版本等,以帮助某人帮助您。
标签: python matplotlib vector 3d