在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/Python/ python的matplotlib怎樣優(yōu)雅地繪制向量?

python的matplotlib怎樣優(yōu)雅地繪制向量?

現(xiàn)在需要繪制3D空間的幾個(gè)向量,該怎么畫(huà)???
類(lèi)似這樣的
圖片描述

回答
編輯回答
只愛(ài)你
from mpl_toolkits.mplot3d import axes3d
import 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()

參考這個(gè) https://matplotlib.org/galler...

2017年9月10日 05:18