title: How to plot a spherical segment in Python?
body: <p>How can one plot a spherical segment, specifically a sphere "slice" in Python?</p>
  
  <p>I know how to plot a sphere surface via </p>
  
  <pre><code>from mpl_toolkits.mplot3d import Axes3D
  import matplotlib.pyplot as plt
  import numpy as np
  fig = plt.figure()
  ax = fig.add_subplot(111, projection='3d')
  u = np.linspace(0, 2 * np.pi, 100)
  v = np.linspace(0, np.pi, 100)
  x = 10 * np.outer(np.cos(u), np.sin(v))
  y = 10 * np.outer(np.sin(u), np.sin(v))
  z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))
  ax.plot_surface(x, y, z,  rstride=4, cstride=4, color='b')
  plt.show()
  </code></pre>
  
  <p>or some variation of that code, but I'm struggeling to plot only a part of the sphere, leading to an image like the following: </p>
  
  <p><a href="https://en.wikipedia.org/wiki/Spherical_segment#/media/File:LaoHaiKugelschicht1.png" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Spherical_segment#/media/File:LaoHaiKugelschicht1.png</a></p>
  
  <p>If I vary the code I presented above by manipulating the definitions of u and v, e.g.:</p>
  
  <pre><code>u = np.linspace(0, 2 * np.pi, 20)
  v = np.linspace(0, np.pi, 20)
  </code></pre>
  
  <p>the sphere is still presented as a whole, but with a very poor resolution.
  Changing the starting point of the linspace range doens't seem to change anything.</p>