[英]using quiver in python to plot a 3d vector
plt.quiver
仅适用于一维和二维阵列。 您应该使用mplot3d
以3维显示图形:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_xlim3d(0, 0.8)
ax.set_ylim3d(0, 0.8)
ax.set_zlim3d(0, 0.8)
ax.quiver(0, 0, 0, 1, 1, 1, length = 0.5, normalize = True)
plt.show()
我建议您阅读pyplot.quiver和axes3d.quiver上的文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.