简体   繁体   English

在网页中嵌入交互式 matplotlib 图

[英]Embed interactive matplotlib plot in a webpage

I have a simple matplotlib scatter plot which uses this code to display an annotation when points are clicked on.我有一个简单的 matplotlib 散点图,它使用此代码在单击点时显示注释。 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?如果有人可以详细解释一下吗?

Edit: 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.但是,在查看网页的源代码时,看起来并没有调用 python 代码。
How do I do something similar?我如何做类似的事情?

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我认为您无法使用之前在网页中使用的相同代码,但是使用像bokeh这样的库和hover工具可以很容易地获得类似的行为

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

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

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