r/IPython • u/lampo808 • Oct 16 '17
Switching from MATLAB to Python: how to make interactive and exportable figures simply
I'm trying to switch from MATLAB to Python, and I'm currently playing around with Jupyter notebooks. The thing I really miss is a simple way to produce figures that have some basic interactivity (pan, zoom, data tip) with a simple syntax and the possibility to export them maintaining the data content and interactivity.
This is something MATLAB let me do out of the box: whenever I plot a graph, either from a script or in the live editor, I can save the figure object (and retrieve the data from it later, something I find very useful sometimes) and navigate around the data.
I know there are many plotting libraries for Python out there, but I can't manage to figure out if there's one that fits my need: I like matplotlib syntax, but I didn't find any easy way for decent interactivity and particularly for export.
NOTE: I'm searching for a package that offers these features built-in, i.e. without writing my own wrappers around the plotting functions, because I want others to be able to install the requested package and open/interact with my data
NOTE 2: the plot I use are basically standard line plots/scatter plots, 1D and 2D histograms, < 1k points most of the time
5
u/lacunosum Oct 16 '17
Did you try
%matplotlib notebook? It enables interactive matplotlib figures. You can pan, zoom, save PNGs, etc. It was introduced a while ago in (I think) matplotlib 1.4/IPython 3.0. Matplotlib does not have functionality for saving a “live figure” like Matlab, but the point of the notebook is to preserve the context (data, code, etc.) that allows you to easily recreate a figure.2
u/imhalfasigmasure Oct 16 '17
Use bokeh library and save them as html
0
u/[deleted] Oct 16 '17
[deleted] — view deleted comment