19

I'm currently using Open Flash Chart 2 on 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.

I'm thinking a lot about matplotlib but the documentation is rather poor on web application developpment.

Does anybody uses matplotlib in his web app? I would appreciate links on those web sites to figure out what can be achieved. Thanks

Mermoz
  • 14,898
  • 17
  • 60
  • 85

5 Answers5

17

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)

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.

Joe Kington
  • 275,208
  • 71
  • 604
  • 463
  • 1
    +1 from me; no idea about the HTML 5/Matplotlib project, though i'm really pleased to see it. – doug Jul 28 '10 at 22:44
  • Thanks Joe. Do you know if this mplh5canvas will let me use the ginput() function on a web app? – chimpsarehungry Mar 31 '13 at 23:50
  • 1
    With the new `webagg` included in matplotlib 1.3 you can have interactive plots in the browser, and I guess it should be possible to use them in a website (but haven't tried nor have seen any examples). – jorgeca Dec 05 '13 at 19:28
  • 3
    @jorgeca - Yeah, `mplh5canvas` is more or less dead. `webagg` is semi-officially the way forward in that regard (it didn't exist yet at the time I answered this question). However, `webagg` depends on having an active python process running to render the images. It's basically a VNC-like protocol. Rasterized images are piped back and forth. It's not something that lends itself to being embedded in a web page. – Joe Kington Dec 05 '13 at 20:24
  • Thanks for the explanation @JoeKington. I knew your answer predated `webagg` but I had no idea it was pushing images. – jorgeca Dec 05 '13 at 22:06
  • 1
    @jorgeca - There's a bit more detail behind the decision here: http://mdboom.github.io/blog/2012/10/11/matplotlib-in-the-browser-its-coming/ Basically, if you're plotting a lot of data, pushing json files of the data to the browser takes more bandwith than just pushing a rendered image. – Joe Kington Dec 05 '13 at 22:18
5

You can use MPLD3 to 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.

Cyryl Płotnicki
  • 473
  • 6
  • 12
3

I have never used matplotlib, but how about using Google's Chart API http://code.google.com/intl/pl-PL/apis/chart/ for charts?

gruszczy
  • 40,948
  • 31
  • 128
  • 181
2

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

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!

perimosocordiae
  • 17,287
  • 14
  • 60
  • 76
1

This tool is nice, but it would awesome if it worked with matplotlib.
http://www.highcharts.com/

Ben
  • 669
  • 8
  • 14