Python Matplotlib:Web 服务器上的交互式绘图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3354883/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Matplotlib: interactive plot on a web server
提问by Mermoz
I'm currently using Open Flash Chart 2on my django website, but I find it insufficiently customizable. (It's great when you want the usual barcharts, piecharts, but what about homemade shapes...). Although it's open source, I don't feel like diving in the Flex code.
我目前在我的 django 网站上使用Open Flash Chart 2,但我发现它的可定制性不足。(当您想要通常的条形图、饼图时,这很棒,但是自制形状呢...)。虽然它是开源的,但我不想深入研究 Flex 代码。
I'm thinking a lot about matplotlib but the documentationis rather poor on web application developpment.
我在想很多关于 matplotlib 的问题,但是关于 web 应用程序开发的文档相当糟糕。
Does anybody uses matplotlib in his web app? I would appreciate links on those web sites to figure out what can be achieved. Thanks
有人在他的网络应用程序中使用 matplotlib 吗?我很感激这些网站上的链接,以找出可以实现的目标。谢谢
采纳答案by Joe Kington
If you're looking for flash-like interactivity in a web application, matplotlib probably isn't what you're looking for. It's fine for rendering a static image to serve out in a web app, though. (and is amazingly flexible)
如果您正在 Web 应用程序中寻找类似 flash 的交互性,那么 matplotlib 可能不是您要寻找的。不过,渲染静态图像以在 Web 应用程序中提供是很好的。(而且非常灵活)
However, there's been a lot of recent development on making matplotlib more oriented toward web interactivity. Take a look at the new HTML5/Canvas backend. http://code.google.com/p/mplh5canvas/It's not quite finished yet, but it's worth playing around with, anyway.
但是,最近在使 matplotlib 更加面向 Web 交互方面取得了很多进展。看看新的 HTML5/Canvas 后端。http://code.google.com/p/mplh5canvas/它还没有完全完成,但无论如何还是值得玩一玩的。
回答by gruszczy
I have never used matplotlib, but how about using Google's Chart APIhttp://code.google.com/intl/pl-PL/apis/chart/for charts?
我从未使用过matplotlib,但是如何使用Google 的 Chart API http://code.google.com/intl/pl-PL/apis/chart/来制作图表?
回答by Ben
This tool is nice, but it would awesome if it worked with matplotlib.
http://www.highcharts.com/
这个工具很好,但如果它与 matplotlib 一起工作会很棒。
http://www.highcharts.com/
回答by Cyryl P?otnicki
You can use MPLD3to export your existing matplotlib stuff to browser.
Matplotlib itself is very powerful, albeit, I agree the documentation is not very extensive.
I've learned it just by trying stuff out and finding examples on the net.
'matplotlib example X' where X is somewhat about what you are trying to plot find suprising amount of code on the net.
您可以使用MPLD3将现有的 matplotlib 内容导出到浏览器。
Matplotlib 本身非常强大,尽管我同意文档不是很广泛。
我只是通过尝试一些东西并在网上找到例子来学习它的。
'matplotlib example X' 其中 X 与您要绘制的内容有关,可以在网上找到数量惊人的代码。
回答by perimosocordiae
Resurrecting an old question with the current state of affairs. As of Fall 2013, there's now an example of embedding matplotlib's WebAgg backend in a Tornado-based webserver: https://github.com/matplotlib/matplotlib/blob/master/examples/user_interfaces/embedding_webagg.py
用当前的状态重新提出一个老问题。截至 2013 年秋季,现在有一个在基于 Tornado 的网络服务器中嵌入 matplotlib 的 WebAgg 后端的示例:https: //github.com/matplotlib/matplotlib/blob/master/examples/user_interfaces/embedding_webagg.py
This makes use of websockets to send the figure updates to the browser, which allows for really nice interactive plots that get rendered client-side. This means that no images are being generated on the server!
这利用 websockets 将图形更新发送到浏览器,这允许在客户端呈现非常好的交互式绘图。这意味着服务器上没有生成图像!

