Useful Jupyter
Useful Jupyter
MatPlotLib
1.1. plotting things
import numpy as np
from matplotlib import pyplot as plt
x = np.linspace(-1,1,100)
y = x**2
plt.title('Title of Plot')
plt.xlabel('$x$-axis')
plt.ylabel('$y$-axis')
plt.plot(x,y)
We need to setup a plt.axes object with the attribute projection='3d' and call plot_surface on it…
import numpy as np
from matplotlib import pyplot as plt
x,y = np.meshgrid(
np.linspace(0,100,100), #x-range
np.linspace(0,100,100) #y-range
)
z = x**2 + y**2
ax = plt.axes(projection='3d')
ax.plot_surface(x,y,z)
r,T = np.meshgrid(
np.linspace(0,100,100), #r-range
np.linspace(0,2*np.pi,100) #theta-range
)
z = r*np.sin(3*T)
ax = plt.axes(projection='3d')
ax.plot_surface(x,y,z)