In [8]:
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from pylab import meshgrid,cm,imshow,contour,clabel,colorbar,axis,title,show
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
In [21]:
def f(x,y, lamb, kappa):
return np.exp(-lamb*(abs(x)**kappa+abs(y)**kappa))
def plot_3D_f(lamb,kappa):
fig = plt.figure(figsize=(20,10))
ax = fig.add_subplot(111, projection='3d')
x = np.arange(-5,5,0.1)
y = np.arange(-5,5,0.1)
X,Y = meshgrid(x, y) # grid of point
Z = f(X, Y, lamb,kappa)
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1,
cmap=cm.RdBu,linewidth=0, antialiased=False, vmin=0)
ax.zaxis.set_major_locator(LinearLocator(10))
fig.colorbar(surf, shrink=0.5, aspect=10)
plt.show()
In [22]:
plot_3D_f(1,1)
In [23]:
plot_3D_f(5,1)
In [24]:
plot_3D_f(1,2)
In [25]:
plot_3D_f(5,2)
In [ ]: