Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ipython notebook --pylab inline: zooming of a plot

Is it possible to zoom into a plot if inline is activated? Especially regarding to 3d-plots rotating and zooming is a necessary feature.

like image 289
varantir Avatar asked May 18 '12 15:05

varantir


People also ask

How do you zoom in on a plot in Python?

If you press 'x' or 'y' while panning the motion will be constrained to the x or y axis, respectively. Press the right mouse button to zoom, dragging it to a new position. The x axis will be zoomed in proportionate to the rightward movement and zoomed out proportionate to the leftward movement.

How do you increase the size of a plot in Jupyter notebook?

Next, to increase the size of the plot in the jupyter notebook use plt. rcParams[“figure. figsize”] method and set width and height of the plot.


2 Answers

You can now use %matplotlib notebook instead of %matplotlib inline and you'll be able to interact with your plots.

like image 157
João Abrantes Avatar answered Sep 21 '22 23:09

João Abrantes


Now thanks to mpld3 it's super easy to enable zooming in inline plots!

All you have to do is install mpld3 (pip install mpld3), and then add this to your notebook:

%matplotlib inline import mpld3 mpld3.enable_notebook() 

Now your plots will get a toolbar menu at the bottom left, in which you can enable mouse zooming :)

like image 41
yonilevy Avatar answered Sep 21 '22 23:09

yonilevy