title: Proper way to plot shapes/parametric equations with python
body: <p>I am new at Python for plotting things, and I am wondering what would be the best way to plot the following figure?</p>
  
  <p><a href="https://i.stack.imgur.com/Zyaas.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zyaas.png" alt="Shape (2 semi-circles and 1 cylinder)"></a></p>
  
  <p>Basically, I'm trying to plot a shape with certain dimensions (2 semi-circles touching a cylinder in the middle (from point 2 to 3))
  Let's say I have access to R2,R3, and the height of M3 point). With this known I tried to plot using parametric equations (x=R.cos(theta), y=r.sin(theta)) for the circles. I used 3D parametric from matplotlib and ended up have one circle. [EDIT] So far it's on a good way to be solved but I am feeling that there must be a better solution to this problem.</p>
  
  <p>But I'm wondering if it's the best approach. I have read online that you can use shape files from the map community for example.</p>
  
  <pre><code># -*- coding: iso-8859-1 -*-
  import matplotlib as mpl
  from mpl_toolkits.mplot3d import Axes3D
  import numpy as np
  import matplotlib.pyplot as plt
  
  
  R2=3
  r3=2
  xp3=1
  
  xp2=R2-np.sqrt(R2**2-r3**2)
  hz=xp3-xp2
  
  print ' -- Values --'
  print 'R2: ',R2
  print 'r3: ',r3
  print 'xp3: ',xp3
  print 'xp2: ',xp2
  print 'hz: ',hz
  
  mpl.rcParams['legend.fontsize'] = 10
  
  fig = plt.figure()
  ax = fig.gca(projection='3d')
  theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
  #z = np.linspace(-2, 2, 100)
  z = 0
  r = R2
  x = r * np.sin(theta)
  y = R2 + r * np.cos(theta)
  ax.plot(x, y, label='test')
  ax.legend()
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/o7uNF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o7uNF.png" alt="exemple"></a></p>
  
  <p>What would be your advice on that?</p>