Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- from matplotlib import cm
- from mpl_toolkits.mplot3d import Axes3D
- from matplotlib.ticker import LinearLocator, FormatStrFormatter
- fig = plt.figure(figsize=(20, 15))
- ax = fig.gca(projection = '3d')
- # Set rotation angle to 30 degrees
- ax.view_init(azim=30)
- X = np.arange(0, 3, 0.001)
- Y = np.arange(0, 3, 0.001)
- X, Y = np.meshgrid(X, Y)
- Z = np.exp(-X**2)*np.log(1 + Y**2) + (1 - np.exp(-X**2))*np.log((1 + Y**2) / (Y**2+0.01))
- # Plot the surface.
- surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm,linewidth=0, antialiased=False)
- ax.set_xlabel('X', fontsize = 20)
- ax.set_ylabel('Y', fontsize = 20)
- ax.set_zlabel('CE (X, Y)', fontsize = 20)
- ax.set_zlim(0, 4.3)
- ax.zaxis.set_major_locator(LinearLocator(10))
- ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
- # Add a color bar which maps values to colors.
- fig.colorbar(surf, shrink=0.5, aspect=5)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement