title: Filling between two lines with Matplotlib with 2 restrictions
body: <p>I would like to fill the area between the curve y1=x^3 and then line y2=3x-2.
  Below is code I have that will do this, however,  I want to place the restriction that y1 &lt; y2 (which I have done with the where option of fill_between) and that x&lt;1.</p>
  
  <p>The problem that occurs with the code below is that the area between the curve is filled for x>1. I would like to plot these graphs on the range [-2.5,2.5]. How do I get matplotlib to stop filling between the curves for x>1?</p>
  
  <p>My code:</p>
  
  <pre><code>import matplotlib.pyplot as plot
  import numpy as np
  
  x = np.linspace(-2.5, 2.5, 100)
  y1 = np.array([i**3 for i in x]) 
  y2 = np.array([3*i-2 for i in x]) 
  
  fig = plot.figure()
  ax = fig.add_subplot(1,1,1)
  ax.plot(x, y1, label=r"$y=x^3$")
  ax.plot(x, y2, label=r"$y=3x-2$")
  ax.spines['left'].set_position('center')
  ax.spines['right'].set_color('none')
  ax.spines['bottom'].set_position('center')
  ax.spines['top'].set_color('none')
  ax.spines['left'].set_smart_bounds(True)
  ax.spines['bottom'].set_smart_bounds(True)
  ax.xaxis.set_ticks_position('bottom')
  ax.yaxis.set_ticks_position('left')
  ax.fill_between(x, y1, y2, where=y2&lt;y1, facecolor='green')
  ax.legend()
  
  plot.show()
  </code></pre>