7

The following example produces an animated graph that can be displayed with jupyter notebook, but in jupyter-lab the graph does not show up.

%pylab inline
import plotly.express as px
gapminder = px.data.gapminder()
px.scatter(gapminder, x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country",
           size="pop", color="continent", hover_name="country",
           log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])

Using plotly 4.0.0 and plotly_express 0.4.0.

Any idea what might be going wrong?

Soerendip
  • 7,684
  • 15
  • 61
  • 128

3 Answers3

10

For JupyterLab support there are couple of additional installation steps: https://plot.ly/python/getting-started/#jupyterlab-support-python-35

Edit: we've consolidated our troubleshooting steps into one handy guide at https://plotly.com/python/troubleshooting/

nicolaskruchten
  • 26,384
  • 8
  • 83
  • 101
  • Thanks for making these useful guides @nicolaskruchten, however I am encountering the same issue with Jupyterlab 3.0.5 and have opened an issue https://github.com/plotly/plotly.py/issues/3052 – Bede Constantinides Jan 28 '21 at 21:22
2

Follow the below Steps to show plots in jupyter notebook, Please follow the below link to find more details on the below commands and thier usange : JupyterLab Support for plotely

  1. pip install jupyterlab "ipywidgets>=7.5"
  2. jupyter labextension install jupyterlab-plotly@4.14.3
  3. jupyter labextension install @jupyter-widgets/jupyterlab-manager
  4. jupyter lab
Arpan Saini
  • 4,623
  • 1
  • 42
  • 50
0

It is because of Nbextension. In configurable nbextensions. You have to disable jupyterlab-plotly/extension and plotlywidget/extension. After that restart the notebook. I hope it will work.here is image of disable