Plotly Express: a Walkthrough

This notebook is the executable version of the example we walk through in our Medium announcement article introducing Plotly Express: a terse, consistent, high-level wrapper around for rapid data exploration and figure generation.

Plotly Express is now part of the main package, so to install it, just follow our Getting Started guide and remember to install the JupyterLab extensions if you're using JupyterLab, otherwise things won't work!

Once you import Plotly Express (aka px), most plots are made with just one function call that accepts a tidy Pandas data frame, and a simple description of the plot you want to make. For example if you want a simple scatter plot, it’s just px.scatter(data, x="column_name", y="column_name"). Here’s an example with the Gapminder dataset – which comes built-in! – showing life expectancy vs GPD per capita by country for 2007:

In [1]:
import as px
gapminder =
gapminder2007 = gapminder.query("year == 2007")

px.scatter(gapminder2007, x="gdpPercap", y="lifeExp")