import numpy as np import matplotlib.pyplot as plt # ################################################################################ def plot_function(): # Make data. X = np.arange(-5, 5, 0.25) Y = np.arange(-5, 5, 0.25) X, Y = np.meshgrid(X, Y) Z = (X ** 2 + Y - 11) ** 2 + (X + Y ** 2 - 7) ** 2 # Plot the surface. fig = plt.figure() ax = fig.gca(projection='3d') surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm, linewidth=0, antialiased=False) ax.set_xlabel('X Label') ax.set_ylabel('Y Label') ax.set_zlabel('Z Label') return X, Y, Z # ################################################################################ X, Y, Z = plot_function()