How To Use Plotly/Plotly Express & Dash With JupyterLab

April 4, 2021
python plotly jupyter jupyterlab dash dashboard visualization
Estimated Reading Time: 2 minute(s)

Plotly is an incredibly useful tool for creating visualizations. It accepts data from a Pandas Dataframe and creates interactive visualizations. Plotly also released Plotly Express which is a higher level wrapper for Plotly. What’s nice is one can start with Plotly Express and go down to Plotly if one need’s more powerful features.

Plotly/Plotly Express Offline Mode In A Jupyterlab Session 

In order to use Plotly/Plotly Express with a Jupyter Lab session one must get Plotly configured in offline mode and have it display its plots inline. Here “offline” mode means Plotly will not upload one’s plots to Plotly’s Chart Studio service.

import plotly.offline as pyo
import as px

# Set notebook mode to work in offline

Dash In A Jupyterlab session 

import dash
from jupyter_dash import JupyterDash
import dash_html_components as html

app = JupyterDash(__name__)

app.layout = html.Div(children = [
    html.H1("The Drunken Sailor Problem"),
    html.H2("A simulated exploration, visualization and dashboard")

    port= 8050,
    dev_tools_hot_reload =True,

This will open a new tab in your Jupyterlab session and display your dashboard. You can rerun the cells to update the dashboard.


At this point you can use Plotly/Plotly Express and Dash inside a Jupyter notebook. Enjoy!

Python Dependency Packaging

September 30, 2019
python distribution

Python, Pandas and SQL (Oh my!)

July 11, 2019
pandas python sql databases

Visualizing Geospatial Data

April 22, 2018
python tutorial visualization
comments powered by Disqus