title: How to animate a 3d plot using python?
body: <p>I have this python code: </p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import mpl_toolkits.mplot3d.axes3d as axes3d
  from matplotlib import cm
  
  fig = plt.figure()
  ax = fig.add_subplot(111, projection='3d')
  
  # Plot solid of revolution along x-axis
  def sor_x(ll, ul):
      u = np.linspace(ll, ul, 60)
      v = np.linspace(0, 2 * np.pi, 60)
      U, V = np.meshgrid(u, v)
  
      X = U
  
      Y = (U**2)*np.cos(V)
      Z = (U**2)*np.sin(V)
  
      ax.set_xlabel('X axis')
      ax.set_ylabel('Y axis')
      ax.set_zlabel('Z axis')
      ax.plot_surface(X, Y, Z, cmap=plt.cm.YlGnBu_r)  
  
  if __name__ == '__main__':
      ll, ul = 0, 1  
      sor_x(ll, ul)
      plt.show()
  </code></pre>
  
  <p>This plots the solid of revolution of function <code>y = x**2</code> along x-axis. Now I have to change this to a 3D animation like this:</p>
  
  <p><a href="https://i.stack.imgur.com/57mBO.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/57mBO.gif" alt="enter image description here"></a> </p>
  
  <p>The code for this animation in mathematica is:</p>
  
  <pre><code>f[r_, ϕ_, z_] := {(2 + Tan[z])Cos[ϕ], (2 + Cos[z]) Sin[ϕ], z}
  vase[α_] := 
     ParametricPlot3D[f[r, ϕ, z], {z, 0, 2  Pi}, {ϕ, 0, α}, 
       AspectRatio -&gt; Automatic, PlotRange -&gt; {{-3, 3}, {-3, 3}, {0, 6}}];
  animation = Table[
       vase[ϕ],
       {ϕ, 0.1, 2π, π/12}];
  Export["rotationskoerper_animation.gif", animation, 
   ConversionOptions -&gt; {"AnimationDisplayTime" -&gt; 0.1, "Loop" -&gt; True}, 
   ImageSize -&gt; {1000, 1000}]  
  </code></pre>