2024-04-28 11:17:07 发布
网友
有没有办法在matplotlib中绘制三维向量场?我见过quiver,但它只谈到“二维箭头向量场”。有没有一个三维的对应物?
LMGTFY: 我想这个搜索词会返回一个3D对应的文档:
"3-D vector field of arrows" matplotlib
但它返回零结果
我不这么认为。matplotlib中的3D绘图是相当新的,到目前为止这就是它的全部功能:http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/index.html
如果正在开发矢量图,可以询问matplotlib邮件列表。
从matplotlib 1.4.x开始,箭袋现在可以在3d中绘图
quiver3d_demo.py in the examples directory:
from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.gca(projection='3d') x, y, z = np.meshgrid(np.arange(-0.8, 1, 0.2), np.arange(-0.8, 1, 0.2), np.arange(-0.8, 1, 0.8)) u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z) v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z) w = (np.sqrt(2.0 / 3.0) * np.cos(np.pi * x) * np.cos(np.pi * y) * np.sin(np.pi * z)) ax.quiver(x, y, z, u, v, w, length=0.1) plt.show()
我不这么认为。matplotlib中的3D绘图是相当新的,到目前为止这就是它的全部功能:http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/index.html
如果正在开发矢量图,可以询问matplotlib邮件列表。
从matplotlib 1.4.x开始,箭袋现在可以在3d中绘图
quiver3d_demo.py in the examples directory:
相关问题 更多 >
编程相关推荐