Python 使用非均匀矩阵的三维绘图

Python 使用非均匀矩阵的三维绘图,python,matplotlib,Python,Matplotlib,如何使用不均匀矩阵构建三维绘图? 例如,我有3个矩阵:x,t,u(点(x[I][j];t[I][j]中的值) 现在我在第三行有一个错误: 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:设置带有序列的数组元素。能否更明确地发布您正在打

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

现在我在第三行有一个错误:

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:设置带有序列的数组元素。

能否更明确地发布您正在打印的数组?你们有点展示了t和x,但不是以一种可复制的方式,你们并没有展示x_矩阵,t_矩阵,或u。调试需要确切地知道您做了什么,而不是大致知道您做了什么。我解决了我的问题。Matplotlib无法绘制具有不均匀矩阵的打印线框。所以我用散点法设置了点,并用绘图法连接了点。
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)