Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animated plotly-express graph not showing up in jupyter-lab

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?

like image 887
Soren Avatar asked Jul 25 '19 18:07

Soren


People also ask

How do I import Plotly Express into Jupyter Notebook?

Simply visit plot.ly and select the + Create button in the upper right hand corner. Select Notebook and upload your Jupyter notebook (. ipynb) file! The notebooks that you upload will be stored in your Plotly organize folder and hosted at a unique link to make sharing quick and easy.

Why Plotly Express is not working?

If you are encountering problems using plotly with Dash please first ensure that you have upgraded dash to the latest version, which will automatically upgrade dash-core-components to the latest version, ensuring that Dash is using an up-to-date version of the Plotly. js rendering engine for plotly .

How do you show graphs in Jupyter Notebook?

Jupyter Notebook - Big Data Visualization Tool IPython kernel of Jupyter notebook is able to display plots of code in input cells. It works seamlessly with matplotlib library. The inline option with the %matplotlib magic function renders the plot out cell even if show() function of plot object is not called.

How do you display plotly plots?

In general, there are five different approaches you can take in order to display plotly figures: Using the renderers framework in the context of a script or notebook (the main topic of this page) Using Dash in a web app context. Using a FigureWidget rather than a Figure in an ipywidgets context.


2 Answers

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/

like image 103
nicolaskruchten Avatar answered Nov 03 '22 19:11

nicolaskruchten


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 [email protected]
  3. jupyter labextension install @jupyter-widgets/jupyterlab-manager
  4. jupyter lab
like image 29
Arpan Saini Avatar answered Nov 03 '22 20:11

Arpan Saini