import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D xx, yy = np.mgrid[-2:2:81j, -3:3:91j] zz = np.exp(-2 * xx**2 - yy**2) * np.cos(2 * xx) * np.cos(3 * yy) fig = plt.figure() ax = fig.add_subplot(projection="3d") ax.plot_surface(xx, yy, zz, rstride=4, cstride=3, color="c", alpha=0.9) ax.contour3D(xx, yy, zz, zdir="x", offset=-3.0, colors="black") ax.contour3D(xx, yy, zz, zdir="y", offset=4.0, colors="blue") ax.contour3D(xx, yy, zz, zdir="z", offset=-2.0) ax.set_xlim3d(-3.0, 2.0) ax.set_ylim3d(-3.0, 4.0) ax.set_zlim3d(-2.0, 1.0) ax.set_xlabel("x") ax.set_ylabel("y") ax.set_zlabel("z") ax.set_title("Superficie con contornos", weight="bold", size=18) # plt.savefig('Graf.png') plt.show()