In [4]:
import matplotlib
# matplotlib.use('Qt5Agg')
%matplotlib inline
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
# http://localhost:8889/notebooks/colorbar_basics.ipynb
def peaks(x,y):
Z= 3*(1-x)**2*np.exp(-(x**2) - (y+1)**2)-10*(x/5 - x**3 -
y**5)*np.exp(-x**2-y**2)- 1/3*np.exp(-(x+1)**2 - y**2)
return Z
x = np.arange(-4,4,0.2)
y = x
X,Y = np.meshgrid(x,y)
Z = peaks(X,Y)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(X,Y,Z)
# plt.plot(range(10))
plt.show()
In [ ]: