title: how to fill a plot only in an interval
body: <p>I am trying to produce a plot wth a fill <em>only in an interval</em>
  I can set one boundary to the interval, but using 2 gives an error message:</p>
  
  <p>This piece of code works</p>
  
  <pre><code>import matplotlib
  import matplotlib.pyplot as plt
  import numpy as np
  x = np.linspace(0, 1, 500)
  y = np.sin(4 * np.pi * x) * np.exp(-5 * x)
  plt.plot(x,y)
  plt.fill_between(x,0, y,where=x&gt;0.25)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/90qyR.png" rel="nofollow noreferrer">Obtained figure</a></p>
  
  <p>Tis piece of code gives an error</p>
  
  <pre><code>import matplotlib
  import matplotlib.pyplot as plt
  import numpy as np
  x = np.linspace(0, 1, 500)
  y = np.sin(4 * np.pi * x) * np.exp(-5 * x)
  plt.plot(x,y)
  plt.fill_between(x,0, y,where=0.5&gt;x&gt;0.25)
  plt.show()
  </code></pre>
  
  <p>----> 7 plt.fill_between(x,0, y,where=0.5>x>0.25)
        8 plt.show()</p>
  
  <p>ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()</p>
  
  <p>I could not figure out how to solve this</p>