matplotlib / ipympl

Matplotlib Jupyter Integration
https://matplotlib.org/ipympl/
BSD 3-Clause "New" or "Revised" License
1.57k stars 227 forks source link

Question: should I use `%matplotlib widget` or `%matplotlib ipympl` #529

Open parmentelat opened 1 year ago

parmentelat commented 1 year ago

the README suggests to use %matplotlib widget

however based on a small experiment that I described also here https://discourse.jupyter.org/t/interactive-matplotlib-in-jupyterlab-no-longer-working/20017/3?u=parmentelat

it seems like using %matplotlib ipympl

works too, and even better in the sense that it works also in vs-code so, which is best ?

(I have several hundreds of notebooks written with %matplotlib notebook and that now must be changed for jlab4/nb7 at least, so as far as possible Id like to change them only once ;-)

and thank you for the awesome tool 👍

parmentelat commented 1 year ago

all this is, of course, unless there's any hope to have %matplotlib notebook work again in jlab4 or nb7 one day ?

ianhi commented 6 months ago

For things running off an ipykernel backend (i.e. jupyterlab) there is not difference. Other systems, like vscode, might have only chosen to support one.

widget is more consistent with naming scheme used in other backend selection magics where the generic name of hte backend system is used e..g `%matplotlib qt.

I personally have preferred ipympl as I think it leads to greater discoverability of this package. So if someone comes across a notebook using it they will have a better chance of searching for the right package to install.

ianhi commented 6 months ago

all this is, of course, unless there's any hope to have %matplotlib notebook work again in jlab4 or nb7 one day ?

As far as I can see there is no hope of this. the notebook backend works fundamentally different system to put matplotlib in the notebook, a system that for various (good) reasons is not what jupyterlab is based on. nb7 is in turn based off the jupyterlab code.

parmentelat commented 6 months ago

I personally have preferred ipympl as I think it leads to greater discoverability of this package. So if someone comes across a notebook using it they will have a better chance of searching for the right package to install.

FWIW that's what I've gone for too, and for that exact same reason :)