Building a Practical Visualization Workflow
A useful visualization workflow starts with a business question, prepares the relevant data, selects an appropriate chart, and interprets the result in context.
Consider a retail dataset containing products, sales quantities, and prices.
Step 1: Prepare the Data
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.DataFrame({
"Product": ["Laptop", "Phone", "Tablet", "Laptop", "Phone", "Tablet"],
"Region": ["North", "South", "East", "South", "North", "East"],
"Quantity": [10, 25, 15, 12, 30, 18],
"Price": [55000, 30000, 25000, 55000, 30000, 25000]
})
df["Revenue"] = df["Quantity"] * df["Price"]
The revenue column is calculated from quantity and price, giving you another measure to analyze.
Step 2: Compare Revenue by Product
revenue_by_product = df.groupby("Product", as_index=False)["Revenue"].sum()
sns.barplot(
data=revenue_by_product,
x="Product",
y="Revenue"
)
plt.title("Total Revenue by Product")
plt.xlabel("Product")
plt.ylabel("Total Revenue")
plt.tight_layout()
plt.show()
This chart compares total revenue across product categories. It uses aggregated values, so each product appears once.
Step 3: Examine Regional Performance
revenue_by_region = df.groupby("Region", as_index=False)["Revenue"].sum()
sns.barplot(
data=revenue_by_region,
x="Region",
y="Revenue"
)
plt.title("Total Revenue by Region")
plt.tight_layout()
plt.show()
This visualization helps compare the revenue contributed by different regions. With real data, you may also investigate whether regional differences result from sales quantity, pricing, or product mix.
Step 4: Choose Charts Based on Analytical Goals
Use the following guidelines when selecting a visualization:
Analytical goal | Recommended chart |
| Compare categories | Bar chart |
| Show changes over time | Line chart |
| Understand numerical distributions | Histogram or box plot |
| Explore relationships between two numerical variables | Scatter plot |
| Examine correlations across numerical variables | Heatmap |
| Compare distributions across groups | Box plot or violin plot |
| Explore several numerical relationships | Pair plot |
Step 5: Communicate Findings Clearly
A visualization should help the audience understand a specific result. Use descriptive titles, meaningful axis labels, consistent units, and readable scales. Avoid misleading axes, excessive colors, and unnecessary visual effects.
For professional reporting, accompany important charts with concise explanations of the observed pattern, its business relevance, and any limitations. This makes the visualization more useful for decision-making.
Python for Data Science
Vishalini A








