title: Drawing a logarithmic spiral in three axes in Python
body: <p>I try to draw a logarithmic spiral in the form of a spring in three axes.
  Using the parametric equations:</p>
  
  <pre><code>x=a*exp(b*th)*cos(th)
  y=a*exp(b*th)*sin(th)
  </code></pre>
  
  <p>Using the code:</p>
  
  <pre><code>import matplotlib as mpl
  from mpl_toolkits.mplot3d import Axes3D
  import numpy as np
  import matplotlib.pyplot as plt
  from math import exp,sin,cos
  from pylab import *
  
  mpl.rcParams['legend.fontsize'] = 10
  
  fig = plt.figure()
  ax = fig.gca(projection='3d')
  n=100
  a=0.5
  b=0.20
  th=np.linspace(0, 500, 10000)
  x=a*exp(b*th)*cos(th)
  y=a*exp(b*th)*sin(th)
  ax.plot(x, y)
  ax.legend()
  
  plt.show()
  </code></pre>
  
  <p>I get:</p>
  
  <p><a href="https://i.stack.imgur.com/JmW3X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JmW3X.png" alt="enter image description here"></a></p>
  
  <p>However, I would like to stretch the spiral along the <code>Z axis</code> to get a result similar to the following, but using the logarithmic spiral as the basis:</p>
  
  <p><a href="https://i.stack.imgur.com/On3PF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/On3PF.png" alt="enter image description here"></a></p>
  
  <p>How can you do it? How do you modify the function by adding a condition to the <code>Z axis</code>?</p>