Scatter Plots in Pandas & Seaborn – Best Practices for Relationship Analysis 2026
Scatter plots are the best way to visualize the relationship between two numerical variables. In 2026, combining Pandas’ quick .plot.scatter() with Seaborn’s scatterplot() and regplot() gives you both fast exploration and insightful, publication-quality visualizations.
TL;DR — Recommended Scatter Plot Methods
df.plot.scatter(x, y)– Quick Pandas scattersns.scatterplot()– Beautiful plots with hue and sizesns.regplot()– Scatter with regression line
1. Basic Scatter Plot with Pandas
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("sales_data.csv")
df.plot.scatter(
x="quantity",
y="amount",
figsize=(10, 6),
alpha=0.6,
s=50, # marker size
color="royalblue"
)
plt.title("Relationship between Quantity and Sales Amount")
plt.xlabel("Quantity Sold")
plt.ylabel("Sales Amount")
plt.grid(True, alpha=0.3)
plt.show()
2. Advanced Scatter Plot with Seaborn
import seaborn as sns
plt.figure(figsize=(11, 7))
sns.scatterplot(
data=df,
x="quantity",
y="amount",
hue="region", # Color by category
size="profit", # Size by another variable
alpha=0.7,
palette="viridis"
)
plt.title("Quantity vs Sales Amount by Region")
plt.xlabel("Quantity Sold")
plt.ylabel("Sales Amount")
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left')
plt.show()
3. Scatter Plot with Regression Line (Very Useful)
plt.figure(figsize=(10, 6))
sns.regplot(
data=df,
x="quantity",
y="amount",
scatter_kws={"alpha": 0.6},
line_kws={"color": "red"}
)
plt.title("Quantity vs Sales Amount with Regression Line")
plt.show()
4. Best Practices in 2026
- Use
alpha=0.6or lower to handle overplotting when you have many points - Use
huein Seaborn to show categorical grouping - Use
sizeparameter to encode a third variable - Use
sns.regplot()when you want to see the trend line - Always add clear titles and axis labels
- For very large datasets, consider sampling or using
hexbininstead
Conclusion
Scatter plots are essential for understanding relationships between two numerical variables. In 2026, start with Pandas .plot.scatter() for quick checks, then use Seaborn’s scatterplot() and regplot() for deeper insights and better visuals. Proper use of hue, size, and alpha will make your scatter plots much more informative and professional.
Next steps:
- Create scatter plots to explore the relationship between quantity and amount, and between profit and sales in your current dataset