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_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()Note the pattern: build each chart normally with Plotly Express, then copy its .data traces into a shared make_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_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.
Check your understanding
Which function builds the multi-chart grid in the lesson?
plotly.subplots.make_subplots creates a grid figure that you fill with traces.
Show answer
B — make_subplots — plotly.subplots.make_subplots creates a grid figure that you fill with traces.
How does the lesson combine a px.bar and a px.line into one figure?
Build each chart normally, then loop over its .data and call fig.add_trace with the row and col.
Show answer
B — Copies each chart's .data traces in with add_trace and row/col — Build each chart normally, then loop over its .data and call fig.add_trace with the row and col.
In make_subplots(rows=1, cols=2, subplot_titles=("Sales", "Orders")), how many panels result?
One row and two columns give two panels next to each other, with the titles labeling them.
Show answer
B — Two side by side — One row and two columns give two panels next to each other, with the titles labeling them.
Clicking a bar should filter the line chart next to it. What do you need?
Cross-chart interactivity outgrows make_subplots and needs a dashboarding tool such as Dash or Streamlit.
Show answer
D — A tool like Dash or Streamlit — Cross-chart interactivity outgrows make_subplots and needs a dashboarding tool such as Dash or Streamlit.
Next
Continue to: Choropleth Maps for visualizing metrics across geographic regions.
🧪 Try It Yourself
Exercise 1 – Create a Subplot Grid
Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.
Press Run to see what your code prints.Exercise 2 – Add a Trace to a Specific Cell
Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.
Press Run to see what your code prints.Exercise 3 – Label Each Panel
Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.
Press Run to see what your code prints.