Python: Is there a way to plot a "partial" surface plot with Matplotlib?

Viewed 9525

I wanted to plot a "partial" surface plot like the following one with Matplotlib example

Note that it's not a complete meshgrid on X-Y plane but missing a corner from top view. The following is the code I tried but didn't work.

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)

The error being:

ValueError: setting an array element with a sequence.

Any pointer would be appreciated! Thanks!

3 Answers
Related