title: Change colour of curve according to its y-value in matplotlib
body: <p>I'm trying to replicate the style of the attached figure using matplotlib's facilities.</p>
  
  <p><img src="https://i.stack.imgur.com/h28Kl.png" alt="Curves whose colour change with height"></p>
  
  <p>Basically, I want to change the colour of the curve according to its y-value using matplotlib.</p>