Strip Charts in Python

Strip charts are like 1-dimensional jittered scatter plots.


Plotly Studio: Transform any dataset into an interactive data application in minutes with AI. Sign up for early access now.

Strip Charts with Plotly Express

Plotly Express is the easy-to-use, high-level interface to Plotly, which operates on a variety of types of data and produces easy-to-style figures.

The px.strip() function will make strip charts using underlying box traces with the box hidden.

See also box plots and violin plots.

In [1]:
import plotly.express as px

df = px.data.tips()
fig = px.strip(df, x="total_bill", y="day")
fig.show()
1020304050SunSatThurFri
total_billday

Strip charts support faceting and discrete color:

In [2]:
import plotly.express as px

df = px.data.tips()
fig = px.strip(df, x="total_bill", y="time", color="sex", facet_col="day")
fig.show()
2040DinnerLunch204020402040
sexFemaleMaletotal_billtotal_billtotal_billtotal_billtimeday=Sunday=Satday=Thurday=Fri

Reference

See function reference for px.strip() for more information and chart attribute options!

What About Dash?

Dash is an open-source framework for building analytical applications, with no Javascript required, and it is tightly integrated with the Plotly graphing library.

Learn about how to install Dash at https://dash.plot.ly/installation.

Everywhere in this page that you see fig.show(), you can display the same figure in a Dash application by passing it to the figure argument of the Graph component from the built-in dash_core_components package like this:

import plotly.graph_objects as go # or plotly.express as px
fig = go.Figure() # or any Plotly Express function e.g. px.bar(...)
# fig.add_trace( ... )
# fig.update_layout( ... )

from dash import Dash, dcc, html

app = Dash()
app.layout = html.Div([
    dcc.Graph(figure=fig)
])

app.run(debug=True, use_reloader=False)  # Turn off reloader if inside Jupyter