1

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.

I found this solution which helped me for popping up a label over a point.

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

On my plot, I'm using this code example for adding rectangles:

http://matthiaseisen.com/pp/patterns/p0203/

Let's use this as example:

Hover square
(source: matthiaseisen.com)

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

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

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
TheHeroOfTime
  • 751
  • 4
  • 9
  • 23

1 Answers1

1

Matplotlib by itself isn't going to give you this functionality. Bokeh (link), another python library, is what you want. Here is an example 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.

benten
  • 1,995
  • 2
  • 23
  • 38