python的matplotlib怎样优雅地绘制向量?
现在需要绘制3D空间的几个向量,该怎么画啊?
类似这样的
回答:
from mpl_toolkits.mplot3d import axes3dimport matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
# Make the grid
x, y, z = np.meshgrid(np.array([1]),
np.array([1]),
np.array([1]))
# Make the direction data for the arrows
u = np.array([1, 0, 0])
v = np.array([0, 1, 0])
w = np.array([0, 0, 1])
ax.quiver(x, y, z, u, v, w, length=0.1, normalize=True)
plt.show()
参考这个 https://matplotlib.org/galler...
以上是 python的matplotlib怎样优雅地绘制向量? 的全部内容, 来源链接: utcz.com/a/159517.html