Creating Dashboards with Plotly
Dashboard idea
A “dashboard” can be as simple as:
- a few key charts
- shown together
- with a consistent theme
You don’t need a full web framework to get this far — Plotly supports multi-plot layouts via make_subplotsmake_subplots, letting you assemble several independent figures into one shareable view.
How the pieces fit together
Building a Plotly dashboard is really a small pipeline: each data source feeds one chart, and every chart’s traces get placed into a shared grid figure.
flowchart LR A["sales DataFrame"] --> B["px.bar(...)
Sales by city"] C["trend DataFrame"] --> D["px.line(...)
Orders trend"] B --> E["make_subplots(rows, cols)"] D --> E E --> F["fig.add_trace(...) per chart"] F --> G["One figure, one layout,
fig.show() renders the dashboard"]
Example: 2 charts in one view
import pandas as pd
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.graph_objects as go
sales = pd.DataFrame({
"city": ["Pune", "Delhi", "Mumbai", "Bengaluru"],
"sales": [120, 180, 90, 160],
})
trend = pd.DataFrame({
"day": [1, 2, 3, 4, 5],
"orders": [120, 140, 130, 160, 155],
})
bar = px.bar(sales, x="city", y="sales", title="Sales by city")
line = px.line(trend, x="day", y="orders", markers=True, title="Orders trend")
fig = make_subplots(rows=1, cols=2, subplot_titles=("Sales", "Orders"))
for trace in bar.data:
fig.add_trace(trace, row=1, col=1)
for trace in line.data:
fig.add_trace(trace, row=1, col=2)
fig.update_layout(title_text="Mini dashboard", showlegend=False)
fig.show()import pandas as pd
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.graph_objects as go
sales = pd.DataFrame({
"city": ["Pune", "Delhi", "Mumbai", "Bengaluru"],
"sales": [120, 180, 90, 160],
})
trend = pd.DataFrame({
"day": [1, 2, 3, 4, 5],
"orders": [120, 140, 130, 160, 155],
})
bar = px.bar(sales, x="city", y="sales", title="Sales by city")
line = px.line(trend, x="day", y="orders", markers=True, title="Orders trend")
fig = make_subplots(rows=1, cols=2, subplot_titles=("Sales", "Orders"))
for trace in bar.data:
fig.add_trace(trace, row=1, col=1)
for trace in line.data:
fig.add_trace(trace, row=1, col=2)
fig.update_layout(title_text="Mini dashboard", showlegend=False)
fig.show()Note the pattern: build each chart normally with Plotly Express, then copy its .data.data traces into a shared make_subplotsmake_subplots grid. You get one figure — one HTML export, one set of hover/zoom controls — instead of juggling several separate files.
Keeping it readable
- Give every subplot its own clear
subplot_titlessubplot_titlesentry — a dashboard with unlabeled panels forces the reader to guess. - Keep a consistent color scheme across panels so the same category means the same color everywhere.
- Don’t cram more than 4-6 charts into one static grid; beyond that, a real dashboarding tool (below) manages layout and filtering far better.
Next step
If you want a full web app dashboard with filters, dropdowns, and cross-chart interactivity, the next tool is usually Dash or Streamlit — both build on top of the same Plotly figures you already know how to create.
Next
Continue to: Choropleth Maps for visualizing metrics across geographic regions.
🧪 Try It Yourself
Exercise 1 – Create a Subplot Grid
Exercise 2 – Add a Trace to a Specific Cell
Exercise 3 – Label Each Panel
If this helped you, consider buying me a coffee ☕
Buy me a coffeeWas this page helpful?
Let us know how we did
