Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactive window with Matplotlib and notebook option #3691

Closed
PierreMarchand20 opened this issue Jan 4, 2019 · 13 comments
Closed

Interactive window with Matplotlib and notebook option #3691

PierreMarchand20 opened this issue Jan 4, 2019 · 13 comments

Comments

@PierreMarchand20
Copy link

Environment data

  • VS Code version: 1.30.1
  • Extension version (available under the Extensions sidebar): XXX
  • OS and version: macOS Mojave
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: Matplotlib

Is %matplotlib notebook supposed to work in vscode ? In my case, it does not:

ReferenceError: IPython is not defined
    at eval (eval at runCodeHere (webpack:///./node_modules/@nteract/transforms/lib/javascript.js?), <anonymous>:767:1)
    at runCodeHere (webpack:///./node_modules/@nteract/transforms/lib/javascript.js?:32:12)
    at JavaScript.componentDidMount (webpack:///./node_modules/@nteract/transforms/lib/javascript.js?:60:7)
    at rh (webpack:///./node_modules/react-dom/cjs/react-dom.production.min.js?:213:482)
    at Xg (webpack:///./node_modules/react-dom/cjs/react-dom.production.min.js?:205:159)
    at Yg (webpack:///./node_modules/react-dom/cjs/react-dom.production.min.js?:204:174)
    at If (webpack:///./node_modules/react-dom/cjs/react-dom.production.min.js?:200:307)
    at Object.enqueueForceUpdate (webpack:///./node_modules/react-dom/cjs/react-dom.production.min.js?:131:37)
    at MainPanel.E.forceUpdate (webpack:///./node_modules/react/cjs/react.production.min.js?:13:311)
    at MainPanel._super.MainPanel._this.updateOrAdd (webpack:///./src/datascience-ui/history-react/MainPanel.tsx?:341:23)
@rchiodo
Copy link
Contributor

rchiodo commented Jan 7, 2019

@PierreMarchand20 what's your extension version?

@PierreMarchand20
Copy link
Author

Oh sorry, it is 2018.12.1. But I am actually starting to think it may not be a bug from vscode. I installed Jupyter and jupyterlab with pip, may be it needs something more to use this option.

@PierreMarchand20
Copy link
Author

I tried with %matplotlib ipyml following https://matplotlib.org/tutorials/introductory/usage.html#ipympl but it did not work either

@PierreMarchand20
Copy link
Author

Ok following https://github.com/matplotlib/jupyter-matplotlib , I got FigureCanvasNbAgg() instead

@rchiodo
Copy link
Contributor

rchiodo commented Jan 7, 2019

What does your cell look like? Is it just a matplotlib?

@rchiodo
Copy link
Contributor

rchiodo commented Jan 7, 2019

The code that's failing is trying to load some javascript returned by jupyter when executing your cell. We send the cell contents to Jupyter and then stick its output js into a react control.

@PierreMarchand20
Copy link
Author

It is just Matplotlib, and it seems that it calls the backend nbagg (https://matplotlib.org/users/prev_whats_new/whats_new_1.4.html#the-nbagg-backend) which calls some javascript (according to https://www.reddit.com/r/IPython/comments/36p360/try_matplotlib_notebook_for_interactive_plots/ but it is really hard to find more information).

@PierreMarchand20
Copy link
Author

Regarding ipympl, since it is a jupyter widget, it may be related to this issue microsoft/vscode-python#3429

@rchiodo
Copy link
Contributor

rchiodo commented Jan 8, 2019

Sorry I wasn't reading your original entry that carefully. %matplotlib notebook changes matplotlib into an interactive widget. That explains why it doesn't work.

Yes I think you're correct. This is likely the same as microsoft/vscode-python#3429. We don't support jupyter extensions yet.

Thanks, this should be a good reference point to figure out how to get them working.

@rchiodo rchiodo closed this as completed Jan 8, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Feb 5, 2019
@microsoft microsoft unlocked this conversation Nov 14, 2020
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 14, 2020
@franva
Copy link

franva commented Apr 28, 2021

how about now?

Does VSCode support jupyter extensions?

@DonJayamanne
Copy link
Contributor

%matplotlib widget works today.
Please try that.

@franva
Copy link

franva commented Apr 28, 2021

thanks @DonJayamanne
just tried and it is almost perfect with 1 glitch.

The animation doesn't start by itself(although the sensory data has been streaming through),
it only starts animating once I resized its plot by dragging a small triangle at the right bottom corner.

I have uploaded a screen recording for this glitch.

nb.mp4

@DonJayamanne
Copy link
Contributor

The animation doesn't start by itself(although the sensory data has been streaming through),

Please could you file a separate bug with a minimal code sample (python packages to be installed) to replicate this issue

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants