如何在网页中嵌入交互式matplotlib图 [英] How to embed an interactive matplotlib plot in a webpage

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

问题描述

我一直在研究如何嵌入交互式matplotlib小部件(例如这样的小部件: http://matplotlib.org/examples /widgets/slider_demo.html ).最终目的是制作一个教育性页面.

I have been searching how to embed an interactive matplotlib widget (like this one: http://matplotlib.org/examples/widgets/slider_demo.html) in a webpage. The final aim is to make an educational page.

我希望我不要重复这个问题.谷歌发现的始终是如何将图以图像格式嵌入为静态照片.

I hope I am not duplicating the question. What google finds is always how to embed the plot as a still-shot, in an image format.

我以为我可以使用 ipython notebook plotly gjango 来做一些事情.但是我很困惑.

I thought I can do something with ipython notebook or plotly or gjango. But I got confused.

吸引人的情节完全有可能吗? 感谢您的指导,我应该为之思考和努力.

Is it possible at all for intractive plots? I appreciate your guides to which direction I should think and work on.

谢谢.

推荐答案

在2015年夏天,我面临着一个类似的任务:嵌入交互式小部件,这些小部件在移动滑块时会更改其基础数据.这与交互式IPython小部件在本地计算机上运行时是交互式的.可以找到我想要的示例 jakevdp的博客

In summer 2015, I'm facing a similar task: embed interactive widgets that change their underlying data when the slider is moved. This is very similar to interactive IPython widgets which are interactive when run on a local machine. Examples of what I want can be found jakevdp's blog.

总结到目前为止已完成的工作:

To summarize work done so far:

  • ipywidgets-static converts interactive IPython widgets to static HTML. However, this library is no longer maintained. Development has moved to ipython/ipywidgets.
  • IPython is working on ipython/ipywidgets. They have a Github issue to make these widgets static and to be embedded in a standalone HTML file.
  • HoloViews provides some interactive slider options that can be embedded in a static HTML file (using IPython's nbconvert)
  • Bokeh plots that rely on interactive sliders require a server.
  • plot.ly doesn't support sliders/etc. I believe this is true based off this blog post.
  • mpld3 converts between matplotlib and d3. I believe this library supports panning and zooming, not sliders/interactivity. Here's a related Github issue

还有一篇博客文章,标题为"浏览器:它来了!".这篇文章的日期为2014-3-31.

There's also blog post titled "Scientific Python in the browser: it's coming!". This post was dated 2014-3-31.

对我来说,两个最吸引人的选项是ipywidgets和HoloViews,但是我很期待IPython提供静态交互式小部件.我希望能在不到2020年的5年内(以及在2017年的2年内)迅速获得对静态交互式窗口小部件的坚实支持.

For me, the two most attractive options are ipywidgets and HoloViews but I'm looking forward to when IPython provides static interactive widgets. I expect to see solid support for static interactive widgets quickly and in less that 5 years/2020 (and in 2 years/2017?).

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

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