In [1]:
import matplotlib.pylab as plt
import numpy as np
# %matplotlib widget
In [2]:
def f(x, y):
return x**2 - y**2
In [3]:
steps = 100
x = np.linspace(-10, 10, steps)
y = np.linspace(-10, 10, steps)
X,Y = np.meshgrid(x,y)
Z = f(X, Y)
In [4]:
origin = np.array([0, 0, 0])
In [5]:
fig = plt.figure(figsize = (6, 6))
ax = plt.axes(projection='3d', box_aspect = (1, 1, 1))
ax.plot(*origin, color = 'blue', marker = 'o')
ax.text(origin[0] + 0.25, origin[1] + 0.25, origin[2] + 0.25, s = 'O', fontsize = 12)
ax.plot_surface(X, Y, Z, color= 'red', alpha = 0.5)
# ax.set_xlim(-10, 10)
# ax.set_ylim(-10, 10)
# ax.set_zlim(-10, 10)
plt.show()
In [ ]:
In [ ]: