Make a label / annotation appear, when hovering over an area (rectangle)
<p>As you can see the question above, I was wondering, if it is possible to popup a label, when I hover on a rectangle-area. </p>

<p>I found this <a href="http://stackoverflow.com/questions/11537374/matplotlib-basemap-popup-box/11556140#11556140">solution</a> which helped me for popping up a label over a <strong>point</strong>. </p>

<p>But is it possible to popup a label, when the user hovers somewhere over an area?</p>

<p>On my plot, I'm using this code example for adding rectangles:</p>

<p><a href="http://matthiaseisen.com/pp/patterns/p0203/" rel="nofollow">http://matthiaseisen.com/pp/patterns/p0203/</a></p>

<p>Let's use this as example:</p>

<p><img src="http://matthiaseisen.com/pp/static/p0203_1.png" alt="Hover square"></p>

<p>When the user hovers (everywhere) over the blue area, a popup "You are hovering over the blue area" should appear.</p>

<p>Is this even possible in matplotlib? I can't find any solution for this problem.</p>

<p>Matplotlib by itself isn't going to give you this functionality. Bokeh <a href="http://bokeh.pydata.org/en/latest/docs/user_guide/quickstart.html" rel="nofollow">(link)</a>, another python library, is what you want. <a href="http://bokeh.pydata.org/en/latest/docs/gallery/texas.html" rel="nofollow">Here is an example</a> with the hovertool feature, which is what you're looking for. You can even export the image as html so you can put it on a website or blog. </p>

python python-2.7 matplotlib