1. Shape, Spread, Skew
Distribution plots summarize continuous variables as bins, smooth densities, or cumulative curves—without needing a scatter of every row.
sns.histplot — discrete bins and counts (stack / layer / dodge)
sns.kdeplot — smooth kernel density (no bins)
sns.ecdfplot — cumulative proportion from 0 to 1
2. Useful Arguments
multiple: stack, layer, or dodge groups
stat: count, density, or probability
bins: number of intervals for histograms
fill: shade under KDE curves
3. Treatment Cost Histogram
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv("healthcare_patient_analytics_seaborn.csv")
plt.figure(figsize=(9, 5))
sns.histplot(data=df, x="Treatment Cost", bins=30)
plt.title("Treatment Cost Distribution (30 Bins)")
plt.xlabel("Treatment Cost ($)")
plt.ylabel("Count")
plt.show()
Mid-range costs dominate; extremes are rarer.
4. Stacked Readmission Risk
plt.figure(figsize=(9, 5))
sns.histplot(
data=df,
x="Readmission Risk",
hue="Visit Type",
multiple="stack",
bins=30
)
plt.title("Readmission Risk Distribution by Visit Type (Stacked)")
plt.show()
5. KDE of Recovery Score
plt.figure(figsize=(9, 5))
sns.kdeplot(
data=df,
x="Recovery Score",
hue="Visit Type",
fill=True
)
plt.title("Recovery Score Density Distribution by Visit Type")
plt.show()
Routine visits often show a sharper, higher density peak than Emergency.
6. ECDF of Length of Stay
plt.figure(figsize=(9, 5))
sns.ecdfplot(
data=df,
x="Length of Stay (Days)",
hue="Visit Type"
)
plt.title("Cumulative Length of Stay (Days) by Visit Type")
plt.ylabel("Proportion")
plt.show()
In the example, about 80% of stays fall at or below 6 days.
7. Quick Comparison
| Plot | Function | Use |
| Histogram | sns.histplot | Binned frequencies |
| KDE | sns.kdeplot | Smooth density |
| ECDF | sns.ecdfplot | Percentile thresholds |