title: Hide axis lines and labels in matplotlib except min/max y-label
body: <p>I have plot in Python matplotlib:</p>
  <pre><code>from matplotlib import pyplot as plt
  
  data = [1, 5, 2, 1, 1, 4, 3, 1, 7, 8, 9, 6, 1]
  plt.plot(data)
  </code></pre>
  <p>Is there any way to hide axis lines and labels except min and max y-axis label? I know about <code>plt.axis(&quot;off&quot;)</code>, however I would like to show first and last label on y-axis.</p>
  <p>The current plot is on the left of the image below and desired plot on the right.</p>
  <p><a href="https://i.stack.imgur.com/m5sji.png" rel="noreferrer"><img src="https://i.stack.imgur.com/m5sji.png" alt="enter image description here" /></a></p>