使用非均匀矩阵绘制

2024-04-19 23:09:12 发布

您现在位置:Python中文网/ 问答频道 /正文

如何使用不均匀矩阵建立三维绘图? 例如,我有3个矩阵:x,t,u(点的值(x[I][j];t[I][j]))

t = [[0, 0, 0],
[0.03, 0.03, 0.03, 0.03, 0.03, 0.03],
[0.06, 0.06, 0.06, 0.06],
...]
x = [[-0.5, -0.25, 0.0],
[-0.5, -0.375, -0.25, -0.1875, -0.0625, 0],
[-0.5, -0.25, -0.125, 0],
...]

第三行有个错误:

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection='3d')
ax.plot_wireframe(x_matrix, t_matrix, u, rstride=1, cstride=1, linewidth=1)

错误:ValueError:使用序列设置数组元素。


Tags: add绘图plot错误figplt矩阵ax