I wanted to plot a "partial" surface plot like the following one with Matplotlib
请注意,它不是 X-Y 平面上的完整网格,而是在俯视图中缺少一个角。以下是我尝试过但不起作用的代码。
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)
错误是:
ValueError:使用序列设置数组元素。
任何指针将不胜感激!
谢谢!