# plotm3d2.py3 matplotlib hump from mpl_toolkits.mplot3d import Axes3D from matplotlib import pyplot as plt import numpy as np print("plotm3d2.py3 running") fig = plt.figure() ax = fig.add_subplot(111, projection='3d') # Create the mesh in polar coordinates and compute corresponding Z. r = np.linspace(0, 1.25, 25) # was 50 p = np.linspace(0, 2*np.pi, 25) # was 50 R, P = np.meshgrid(r, p) Z = ((R**2 - 1)**2) # Express the mesh in the cartesian system. #X, Y = R*np.cos(P), R*np.sin(P) X = R*np.cos(P) Y = R*np.sin(P) print("R=", R) print("P=", P) print("X=", X) print("Y=", Y) print("Z=", Z) # Plot the surface. ax.plot_surface(X, Y, Z, cmap=plt.cm.YlGnBu_r) # Tweak the limits and add latex math labels. ax.set_zlim(0, 1) ax.set_title('plotm3d2.py3 hump in valley') ax.set_xlabel(r'$\phi_\mathrm{real}$') ax.set_ylabel(r'$\phi_\mathrm{im}$') ax.set_zlabel(r'$V(\phi)$') plt.show() print("plotm3d2.py3 finished")