5

I would like to have zooming and panning options for plots generated in matplotlib on jupyter notebook. I tried installing mpld3 but importing the package doesn't generate my plots at all. Is it an issue of the version of Anaconda I'm using (Anaconda2)? What should I do to fix it? Any help is appreciated, Thank You

eyllanesc
  • 221,139
  • 17
  • 121
  • 189
Tanmay Bhore
  • 59
  • 1
  • 7
  • Try run magic command `%matplotlib notebook` prior to the plot. – swatchai Dec 09 '18 at 04:57
  • 2
    For zooming and panning you need an interactive backend. Often the default settings of IPython/jupyter notebook are to show a png image of the plot; pngs are not interactive. You may use e.g. `%matplotlib qt`, `%matplotlib notebook`, `%matplotlib ipympl`. – ImportanceOfBeingErnest Dec 09 '18 at 11:20

1 Answers1

0

for me, the following worked:

  1. install ipympl, the backend for matplotlib to draw, is interactive: pip install ipympl or conda install ipympl (ipympl install in jupyter-notebook (python3))
  2. install ipywidgets, the jupyter stuff ipympl needs to draw: pip install ipywidgets or conda install ipywidgets (IPython Notebook ipywidgets does not show)
  3. use the matplotlib magic: %matplotlib ipympl

related other questions:

hintze
  • 394
  • 1
  • 11