Data visualization means turning raw data into visuals (charts, tables, dashboards) so humans can easily understand patterns, trends, and performance.
In this guide, we’ll clearly explain:
You’ll also get:
1️⃣ Dashboards vs Reports
What Is a Dashboard?
A dashboard is an interactive screen that shows multiple important metrics at once.
Think of it like a car dashboard:
All visible at once.
Dashboards Are Used For:
They are usually:
What Is a Report?
A report is a structured document that explains data in detail.
It may include:
Reports are:
📌 Comparison Table
| Feature | Dashboard | Report | |---------------|-----------|--------| | Real-time | Yes | Usually No | | Interactive | Yes | Rarely | | Detail Level | Summary | Detailed | | Purpose | Monitoring | Explanation | | Audience | Managers/Executives | Analysts/Stakeholders |
2️⃣ Tables
Tables display data in rows and columns.
They are best when:
Example Dataset
import pandas as pd
data = {
"Product": ["A", "B", "C"],
"Sales": [1000, 1500, 700],
"Profit": [200, 300, 100]
}
df = pd.DataFrame(data)
print(df)
Markdown Table Version
| Product | Sales | Profit | |---------|-------|--------| | A | 1000 | 200 | | B | 1500 | 300 | | C | 700 | 100 |
Tables are good for precision but not great for spotting trends.
3️⃣ Scatter Charts
A scatter plot shows the relationship between two numeric variables.
Example question:
Does advertising spending increase sales?
Example Code
import matplotlib.pyplot as plt
advertising = [10, 20, 30, 40, 50]
sales = [100, 150, 200, 250, 300]
plt.scatter(advertising, sales)
plt.xlabel("Advertising Budget")
plt.ylabel("Sales")
plt.title("Advertising vs Sales")
plt.show()
What You Learn:
4️⃣ Bubble Charts
A bubble chart is a scatter plot with a third variable shown by bubble size.
It answers:
Example:
Example Code
market_share = [5, 10, 15, 20, 25] # third variable
plt.scatter(advertising, sales, s=[m * 20 for m in market_share])
plt.xlabel("Advertising Budget")
plt.ylabel("Sales")
plt.title("Bubble Chart Example")
plt.show()
Bigger bubbles = larger third variable value.
5️⃣ KPI (Key Performance Indicator)
A KPI is a single important metric that measures performance.
Examples:
KPIs are used in dashboards to quickly answer:
"Are we performing well?"
Example KPI Calculation
total_sales = sum(sales)
average_sales = sum(sales) / len(sales)
print("Total Sales:", total_sales)
print("Average Sales:", average_sales)
KPIs should be:
KPI Example Table
| KPI Name | Value | |-----------------|-------| | Total Sales | 1000 | | Average Sales | 200 | | Growth Rate (%) | 15% |
6️⃣ Gauge Chart
A gauge chart looks like a speedometer.
Used for:
Example: Sales target progress
Example Code (Using Plotly)
import plotly.graph_objects as go
fig = go.Figure(go.Indicator(
mode="gauge+number",
value=75,
title={'text': "Target Achievement (%)"},
gauge={
'axis': {'range': [0, 100]}
}
))
fig.show()
If value = 75:
→ You achieved 75% of target.
Gauge charts are visually appealing but should not be overused.
7️⃣ When to Use Each Visualization
| Visualization | Best Used For | |--------------|--------------| | Table | Exact values and small datasets | | Scatter Plot | Relationship between 2 numeric variables | | Bubble Chart | Relationship between 3 variables | | KPI | Highlight one key number | | Gauge | Show progress toward goal | | Dashboard | Monitor multiple KPIs at once | | Report | Provide detailed explanation |
8️⃣ Simple Dashboard Example (Streamlit)
Install:
pip install streamlit
Create file app.py:
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
st.title("Sales Dashboard")
advertising = [10, 20, 30, 40, 50]
sales = [100, 150, 200, 250, 300]
df = pd.DataFrame({
"Advertising": advertising,
"Sales": sales
})
# KPI
st.metric("Total Sales", sum(df["Sales"]))
# Scatter Plot
fig, ax = plt.subplots()
ax.scatter(df["Advertising"], df["Sales"])
ax.set_xlabel("Advertising")
ax.set_ylabel("Sales")
st.pyplot(fig)
Run:
streamlit run app.py
You now have a working dashboard 🎉
FULL COMPILED CODE (All Code Together)
Below is everything combined into one script:
# Install required libraries first:
# pip install pandas matplotlib plotly streamlit
import pandas as pd
import matplotlib.pyplot as plt
import plotly.graph_objects as go
# ----------------------------
# Sample Data
# ----------------------------
advertising = [10, 20, 30, 40, 50]
sales = [100, 150, 200, 250, 300]
market_share = [5, 10, 15, 20, 25]
df = pd.DataFrame({
"Advertising": advertising,
"Sales": sales,
"Market Share": market_share
})
print(df)
# ----------------------------
# Scatter Plot
# ----------------------------
plt.scatter(df["Advertising"], df["Sales"])
plt.xlabel("Advertising Budget")
plt.ylabel("Sales")
plt.title("Advertising vs Sales")
plt.show()
# ----------------------------
# Bubble Chart
# ----------------------------
plt.scatter(
df["Advertising"],
df["Sales"],
s=[m * 20 for m in df["Market Share"]]
)
plt.xlabel("Advertising Budget")
plt.ylabel("Sales")
plt.title("Bubble Chart Example")
plt.show()
# ----------------------------
# KPI Calculations
# ----------------------------
total_sales = sum(df["Sales"])
average_sales = sum(df["Sales"]) / len(df["Sales"])
print("Total Sales:", total_sales)
print("Average Sales:", average_sales)
# ----------------------------
# Gauge Chart
# ----------------------------
fig = go.Figure(go.Indicator(
mode="gauge+number",
value=75,
title={'text': "Target Achievement (%)"},
gauge={'axis': {'range': [0, 100]}}
))
fig.show()