7

Is there any way of getting interactive tooltips in a matplotlib plot? For instance, I wanted to get this scatter plot with hovering tooltips (http://mpld3.github.io/examples/scatter_tooltip.html) functionality in my python application, because they are really useful for visualizations. Unfortunately, I do not want to show this in a browser, but integrated in my own python application, is there any way to do this?

MrPedru22
  • 1,324
  • 1
  • 13
  • 28
  • 1
    Well there is https://stackoverflow.com/questions/7908636/possible-to-make-labels-appear-when-hovering-over-a-point-in-matplotlib – Ajasja Feb 11 '17 at 11:30

1 Answers1

7

Matplotlib can only create static images and animations. If you want something interactive, then the only way you're going to achieve this is by using a module that outputs javascript. I would suggest reading about bokeh.

It is well developed and gaining a lot of traction in the python world as being a good option for creating interactive plots. Here's an example of bokeh's hovertool capability.

Unfortunately, I do not want to show this in a browser, but integrated in my own python application

I'm not sure what your "own python application" is but you're not going to have a fun time making an interactive plot outside of a browser. I would highly suggest going a webapp route using bokeh if interactivity is truly important to you.

Austin A
  • 2,990
  • 6
  • 27
  • 42
  • Thank you, I already knew about bokeh, and I know it's also possible to do similar interactive stuff with mpld3 library, I really wanted to do it without using a browser, but okay, thanks! – MrPedru22 Nov 13 '15 at 18:01
  • Yea, unfortunately you need a dynamic environment to support interactions and a webapp is the most popular and easiest way to go here. There are are some great python webapp frameworks ([django](https://www.djangoproject.com/), [flask](http://flask.pocoo.org/), etc) that make webdev pretty intuitive and easy. It's very possible that you're already familiar with these. – Austin A Nov 13 '15 at 18:27