title: Annotating ranges of data in matplotlib
body: <p>How can I annotate a range of my data? E.g., say the data from <code>x = 5</code> to <code>x = 10</code> is larger than some cut-off, how could I indicate that on the graph. If I was annotating by hand, I would just draw a large bracket above the range and write my annotation above the bracket.</p>
  
  <p>The closest I've seen is using <code>arrowstyle='&lt;-&gt;'</code> and <code>connectionstyle='bar'</code>, to make two arrows pointing to the edges of your data with a line connecting their tails. But that doesn't quite do the right thing; the text that you enter for the annotation will end up <em>under</em> one of the arrows, rather than above the bar.</p>
  
  <p>Here is my attempt, along with it's results:</p>
  
  <pre><code>annotate(' ', xy=(1,.5),  xycoords='data',
              xytext=(190, .5), textcoords='data',
              arrowprops=dict(arrowstyle="&lt;-&gt;",
                              connectionstyle="bar",
                              ec="k",
                              shrinkA=5, shrinkB=5,
                              )
              )
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/4dfm6.png" alt="Annotation attempt"></p>
  
  <p>Another problem with my attempted solution is that the squared shape of the annotating bracket does not really make it clear that I am highlighting a range (unlike, e.g., a curly brace). But I suppose that's just being nitpicky at this point.</p>