Unable to render matplotlib widgets correctly with Jupyter Notebook Renderers #16342
-
I don't know if this is the issue with the extension itself or if I am using it incorrectly. If I run the ipynb with Jupyter notebook or the python file with vscode, the sliders and other matplotlib widgets are interactive. However, if I run the ipynb with vscode, I only get a non-interactive png output. In other words, the renderer extension does not output the interactive widgets as expected. For kernel, I am using python 3.12 environment from anaconda in both Jupyter notebook and vscode. Most matplotlib and numpy functions except the widgets work, so I suppose the issue is with the renderer instead of kernel, function import, or other extensions. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
To get interactive outputs in notebooks, you need to run the following magic I'm surprised it works in Jupyter, I've tried Jupyter Lab and get the exact same output in VS Code as well (i.e. a non-interactive image). |
Beta Was this translation helpful? Give feedback.
To get interactive outputs in notebooks, you need to run the following magic
%matplotlib widget
https://matplotlib.org/stable/users/explain/figure/interactive.html#jupyter-notebooks-jupyterlab
I'm surprised it works in Jupyter, I've tried Jupyter Lab and get the exact same output in VS Code as well (i.e. a non-interactive image).
Running the above magic before running the cell works as expected.
Not you need to install
ipympl
, see the link.