In [ ]:
import matplotlib.pyplot as plt
import numpy as np
In [ ]:
#values for preparing x and y
x= np.linspace(-1, 5, 10)
y= np.linspace(-1, 5, 10)
In [ ]:
#compose x and y into 2d surface
X, Y = np.meshgrid(x, y)
Z = np.cos(np.sqrt(X**2 + Y**2))
In [ ]:
#set up 3d space
fig = plt.figure(figsize=(8,6))
ax = fig.add_subplot(projection='3d')

#bring everything together
ax.plot_surface(X, Y, Z, cmap='cool')
plt.show()
No description has been provided for this image
In [ ]:
# different graph
#generate some data points for x and y
x2 = np.linspace(1, 10, 100)
y2 = np.linspace(1, 10, 100)
In [ ]:
# compose 2d surface based on x and y; define the function
X, Y = np.meshgrid(x2, y2)
Z = np.log(X**2 + Y**2)
In [ ]:
#set up the 3d space
fig = plt.figure(figsize=(8,6))
ax = fig.add_subplot(projection='3d')

#put everything together
ax.plot_surface(X, Y, Z, cmap='hsv')
plt.show()
No description has been provided for this image
In [ ]: