title: How do I limit my graph from going below zero in matplotlib
body: <p>I've been working on my programming project for school. The goal is to simulate ballistic trajectory including wind resistance with a graph.</p>
  
  <p>I've reached my goal and just want to add some details. One detail being limiting the graph so it doesn't go below zero (since it doesn't make much sense to show the path of the projectile below ground). I want matplotlib to stop plotting the graph as soon as f(x) &lt; 0.</p>
  
  <p>However, I have no idea how to do that. I have noticed that I set the range for x by using x = np.linespace(0, 10000, 500). If the graph would go below 0 or above 10000 on the x-axis it would get cut off at 0 and/or 10000. How do I do the same thing for y?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  *bunch of variables*
  
  x = np.linespace(0, 10000, 500)
  y = *formula for ballistic trajectory*
  y_0 = 0 * x 
  
  *labels and titles*
  plt.grid()
  plt.xlim(0)
  plt.ylim(0)
  plt.plot(x, y)
  plt.plot(x, y_0, color="black")
  plt.show
  </code></pre>