在网页中嵌入交互式 matplotlib 图 [英] Embed interactive matplotlib plot in a webpage

查看:118
本文介绍了在网页中嵌入交互式 matplotlib 图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的 matplotlib 散点图,它使用 这段代码单击点时显示注释.我需要将其嵌入到网页中.我该怎么做?

I have a simple matplotlib scatter plot which uses this code to display an annotation when points are clicked on. I need to embed this in a webpage. How should I do this?

我在这里也发现了类似的问题,但不太明白答案.如果有人可以详细解释一下吗?

I found similar questions here as well but couldn't quite understand the answers. If someone could explain it a bit clearly in detail please?

我需要做类似 this 的操作,其中交互式散点图是显示在网页中.然而,在查看网页的源代码时,它看起来不像是在调用python代码.
我该如何做类似的事情?

I need to do something like this, with the interactive scatter plot being displayed in the webpage. However, on looking at the source code of the webpage, it did not look like the python code is being called.
How do I do something similar?

推荐答案

我认为您无法使用以前在网页中使用过的相同代码,而是使用bokehhover 工具可以很容易地获得类似的行为

I don't think you'll be able to use the same code that you used before in a webpage, but using a library like bokeh and the hover tool would make it fairly easy to get a similar behaviour

http://docs.bokeh.org/en/latest/docs/user_guide/tools.html#hovertool

这篇关于在网页中嵌入交互式 matplotlib 图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆