question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Graph animations do not work in jupyter notebook in vscode

See original GitHub issue

Environment data

  • VS Code version: XXX
  • Jupyter Extension version (available under the Extensions sidebar): 2020.12.414227025
  • Python Extension version (available under the Extensions sidebar): 2020.12.424452561
  • OS (Windows | Mac | Linux distro) and version: Windows 10 Home Version 1909 OS Build 18363.1256
  • Python and/or Anaconda version: 3.7.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
  • Jupyter server running: Local | Remote | N/A: Local

Expected behaviour

plotly

See: https://plotly.com/python/animations/

Actual behaviour

Animation does not work in Visual Code with plotly.express but works in Google Collaboratory.

The output from VisualCode-jupyter is pasted below. In case of executing the code in Visual Code the graph does not animate and moving the slider has no effect on the graph.

plotlyinvisualcode

Steps to reproduce:

The code tested for plotting with animation is: ` import plotly.express as px df = px.data.gapminder()

fig = px.scatter(df, x=“gdpPercap”, y=“lifeExp”, animation_frame=“year”, animation_group=“country”,

   size="pop", color="continent", hover_name="country", facet_col="continent",
   log_x=True, size_max=45, range_x=[100,100000], range_y=[25,90])

fig.show() `

Additional information

The issue was raised on visualcode. However, it looks like something isn’t working in plotly itself. If you open the ‘Developer Webview Tools’, it throws up a bunch of warnings:

image

Those warnings appear if you drag the slider.

_Originally posted by @rchiodo in https://github.com/microsoft/vscode-jupyter/issues/4364#issuecomment-759603424_

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
nicolaskruchtencommented, Mar 11, 2021

Indeed it seems to be vscode-specific, I’m not sure there’s anything for us to do on our end until someone figures out what vscode is doing that interferes with it and can’t be fixed on their end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Animation not working in jupyter notebook in vscode
An introduction to creating animations with Plotly in Python. The chart can be rendered in a jupyter notebook in vscode, but the animation...
Read more >
Animate / update a matplotlib plot in VS Code notebook
I think it involves the magic %matplotlib notebook mode which VS Code does not seem to support, but I don't know if there...
Read more >
Working with Jupyter Notebooks in Visual Studio Code
Visual Studio Code supports working with Jupyter Notebooks natively, and through Python code files.
Read more >
Embedding animation into Jupyter Notebook - NumFys
If the animation doesn't show up in the browser, a possible reason is that the file-type is not supported by the browser. Make...
Read more >
Tips and Tricks — mayavi 4.8.1 documentation
There are three different ways in which one can embed Mayavi visualizations in a Jupyter notebook. The best way is to use the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found