小编Sha*_*awn的帖子

Python:有没有办法用Matplotlib绘制"部分"曲面图?

我想用Matplotlib绘制一个"部分"表面图,如下图所示 例

请注意,它不是XY平面上的完整网格网格,而是从顶视图中缺少一个角.以下是我试过的代码,但没有用.

import numpy as np
from matplotlib import pyplot
from mpl_toolkits.mplot3d import Axes3D

X = np.array([[0,1],
              [0,1,2],
              [0,1,2,3],
             ])
Y = np.array([[0,0],
              [1,1,1],
              [2,2,2,2],
             ])
Z = np.array([[0.5, 0.6],
              [0.7, 0.8, 0.9],
              [1.0, 1.1, 1.2, 1.3],
             ])
fig = pyplot.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X,Y,Z)
Run Code Online (Sandbox Code Playgroud)

错误是:

ValueError:使用序列设置数组元素.

任何指针将不胜感激!谢谢!

python matplotlib

7
推荐指数
1
解决办法
4071
查看次数

标签 统计

matplotlib ×1

python ×1