sns.lineplot draws trends — and does something Matplotlib doesn't: when there are multiple y-values per x, it aggregates them (mean by default) and draws a shaded confidence interval automatically.
Automatic aggregation
# Many observations per x → Seaborn plots the mean and a 95% CI bandsns.lineplot(data=fmri, x="timepoint", y="signal")sns.lineplot(data=fmri, x="timepoint", y="signal", hue="region") # a line per groupsns.lineplot(data=df, x="t", y="v", errorbar=None) # turn the band off
When to use it
Key takeaways
- 01sns.lineplot draws trends and auto-aggregates multiple y per x (mean) with a CI band.
- 02The shaded band shows uncertainty in the mean — great for experimental data.
- 03hue draws one line per group with its own band.
- 04errorbar controls or removes the interval (None, ("ci",95), ("sd",1)).
