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

remark: ipympl-0.6.2 seems to have no interactive feature working when under vscode-python #295

Closed
stonebig opened this issue Jan 17, 2021 · 9 comments

Comments

@stonebig
Copy link
Contributor

playing on latest Jupyter, with lates ipymml, with VScode-Python of today (new version next week):

  • ipympl does render,
  • but interactvity seems not working.

code tried:

%matplotlib widget
# Testing matplotlib interactions with a simple plot
import matplotlib.pyplot as plt
import numpy as np
# warning ; you  need to launch a second time %matplotlib widget, if after a %matplotlib inline 
%matplotlib widget

fig = plt.figure()  #plt.figure(1)
plt.plot(np.sin(np.linspace(0, 30, 100)))
plt.show()

image

@stonebig stonebig changed the title remark: ipympl-0.6.2 seems to have lost its interactivity with vscode-python remark: ipympl-0.6.2 seems to have no intereactive feature working when under vscode-python Jan 17, 2021
@stonebig stonebig changed the title remark: ipympl-0.6.2 seems to have no intereactive feature working when under vscode-python remark: ipympl-0.6.2 seems to have no interactive feature working when under vscode-python Jan 17, 2021
@ianhi
Copy link
Collaborator

ianhi commented Jan 18, 2021

Do other jlab3 compatible widgets work in vscode? For exmample does a slider from ipywidgets 7.6 work?

@asteppke
Copy link

asteppke commented Jan 4, 2022

An update to this issue: with the current ipympl (0.8.4) and Visual Studio Code 1.63.2 the widget and interactivity work well.

What is still missing is that the png representation is not shown if the notebook is saved and reload in VS code which works in Jupyterlab.

@martinRenou
Copy link
Member

Thank you for the update!

What is still missing is that the png representation is not shown if the notebook is saved and reload in VS code

Is there something showed or is the cell output empty? I guess it's an issue on the side of VSCode, we won't be able to do much about it.

@asteppke
Copy link

asteppke commented Jan 4, 2022

Upon closer inspection VS code shows a tiny icon on the left:
image

This allows you to change the mimetype interpretation for this cell output, and, when selecting mimetype as image/png the plot shows up correctly. So this now only requires a tiny change on the VS code people to show the image/png as a default if the application/vnd.jupyter.widget-view+json does not render any output.

This has in general come so far and is is fantastic to see all these bits coming together.

@martinRenou
Copy link
Member

Great :)

this now only requires a tiny change on the VS code people to show the image/png as a default if the application/vnd.jupyter.widget-view+json does not render any output

I guess it could be worth an issue/question in https://github.com/microsoft/vscode-jupyter.

I am surprised the application/vnd.jupyter.widget-view+json is not able to show up, I would expect the latest release to contain the static plot at least if there is no live kernel. Are other kinds of widgets like ipywidgets.IntSlider able to render when doing the save then reload?

@asteppke
Copy link

asteppke commented Jan 4, 2022

Yes, let's raise an issue there for the vscode people to address this.

Regarding the other widgets, the IntSlider works in general, when reloading an IntSlider I get another icon at the side but no rendered output:
image

When using that icon to change the mimetype to text/plain it yields something useful though as a text representation: IntSlider(value=0)

@martinRenou
Copy link
Member

Ok, so I suppose it could be a general issue of vscode-jupyter not able to render any application/vnd.jupyter.widget-view+json on reload.

Please put a link here if you open a related issue on the vscode-jupyter repo :)

I will close this one as resolved.

@asteppke
Copy link

asteppke commented Jan 4, 2022

Great, let's see what the vscode-jupyter people can do about this. I created an issue at microsoft/vscode-jupyter#8635.

@martinRenou
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants