简体   繁体   English

matplotlib图中的交互式工具提示

[英]Interactive tooltips in matplotlib plot

Is there any way of getting interactive tooltips in a matplotlib plot? 有没有办法在matplotlib图中获取交互式工具提示? 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. 例如,我想在我的python应用程序中使用悬停工具提示( http://mpld3.github.io/examples/scatter_tooltip.html )功能获得这个散点图,因为它们对可视化非常有用。 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? 不幸的是,我不想在浏览器中显示它,但是在我自己的python应用程序中集成,有没有办法做到这一点?

Matplotlib can only create static images and animations. Matplotlib只能创建静态图像和动画。 If you want something interactive, then the only way you're going to achieve this is by using a module that outputs javascript. 如果你想要一些交互式的东西,那么你要实现这一目标的唯一方法就是使用一个输出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. 它已经发展得很好,并且在python世界中获得了很大的吸引力,因为它是创建交互式绘图的好选择。 Here's an example of bokeh's hovertool capability. 是bokeh的hovertool功能的一个例子

Unfortunately, I do not want to show this in a browser, but integrated in my own python application 不幸的是,我不想在浏览器中显示它,而是集成在我自己的python应用程序中

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. 我不确定你的“自己的python应用程序”是什么,但是你不会在浏览器之外制作一个交互式的情节。 I would highly suggest going a webapp route using bokeh if interactivity is truly important to you. 如果交互性对您来说非常重要,我强烈建议您使用散景进行webapp路由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM