Here is the explanation for the code:
- x is a list of 25 numbers varying from -2 to +2 with equal spacing between them; similarly, y is a list of 25 numbers varying from -5 to +5, and x and y are the meshgrid between x and y.
- ax.set_zlim(-4, 4) sets the z axis limits to -4 to +4. Since z is a function of a variable, phi, these data limits keep varying on the z axis. To avoid changing limits on the plot, set the limits with a maximum boundary of -4 to +4.
- wframe = None initializes the wframe variable.
- for phi in np.linspace(0, 90, 100): is the for loop and starts with 0, then goes all the way to 90 degrees in 100 equal steps.
- if wframe: checks whether the wireframe is already there. It will only not be there the first time, ...