1

I'd like to output the image to the web created in matplotlib having the very same functionality like it has on desktop when you run the image.show(), for example scaling, moving along the plot more thoroughly.

I've checked out #stack and got old post only offering static images or gif or matplotlib.animate()

I aslo had a look at matplotlib widgets, but those are for desktop GUI only as far as I can see.

Please share some experience or ideas regarding how can I achieve it.

Thanks

Aleks_Saint
  • 67
  • 1
  • 2
  • 12

2 Answers2

1

Matplotlib is a server side library so you cannot do anything on the client side like that.

The closest you can come is to either use mpld3 (mpld3 works by converting a matplotlib graph into the html/js that a d3 js graph would need to render) or a different client side library that plots points.

Sayse
  • 42,633
  • 14
  • 77
  • 146
  • That's awesome, thank you very much. Have you tried it yourself? Are there any viable examples of django/mpld3 integrated? – Aleks_Saint Feb 13 '17 at 10:49
  • @Aleks_Saint - I created a proof of concept for our application in mpld3 but we decided that our use case didn't require it in the end. The linked docs have [lots of examples](http://mpld3.github.io/examples/index.html). – Sayse Feb 13 '17 at 10:51
1

The easiest way of serving pure matplotlib to the web is using a jupyter notebook.

Other than that, you may want to look at specific libraries like Plotly or bokeh.

ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712
  • I've checked them out, however the mpld3 looks more of what I need. Thank you! – Aleks_Saint Feb 13 '17 at 10:50
  • I once started using mpld3 and after a while realized that bokeh was much better suited, since it can be run dynamically on a server as well as statically served on the webpage. At the end it all depends on the application. – ImportanceOfBeingErnest Feb 13 '17 at 15:59
  • checked out bokeh more thoroughly, it looks like it is designed for pretty massive stand-alone apps, but that opens pretty interesting perspectives, I appreciate your sharing it with me, thank you! – Aleks_Saint Feb 14 '17 at 08:57