max_range = np.array([self.x.max() - self.x.min(), self.y.max() - self.y.min(), self.plot_z.max() - self.plot_z.min()]).max() Xb = 0.5 * max_range * np.mgrid[-1:2:2, -1:2:2, -1:2:2][0].flatten() + 0.5 * ( self.x.max() + self.x.min()) Yb = 0.5 * max_range * np.mgrid[-1:2:2, -1:2:2, -1:2:2][1].flatten() + 0.5 * ( self.y.max() + self.y.min()) Zb = 0.5 * max_range * np.mgrid[-1:2:2, -1:2:2, -1:2:2][2].flatten() + 0.5 * ( self.plot_z.max() + self.plot_z.min()) # Comment or uncomment following both lines to test the fake bounding box: for xb, yb, zb in zip(Xb, Yb, Zb): ax.plot([xb], [yb], [zb], 'w') (xx, yy), zz = np.meshgrid(self.x, self.y), self.plot_z ax.plot_surface(xx, yy, zz, rstride=quol, cstride=quol, alpha=0.3, color=col, cmap=cmap)