Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Master Data Science with Python

Lesson 38 of 60 · python

Seaborn Regression Plots

Duration: 20 minutes

Regression Plots in Seaborn

Understanding relationships between variables is crucial for data science.

regplot – simple linear regression

sns.regplot(x='hours', y='score', data=tips, scatter_kws={'alpha':0.6}, line_kws={'color':'red'})
plt.title('Regression of Score on Study Hours')
plt.show()

lmplot – regression with facets

sns.lmplot(x='hours', y='score', hue='sex', data=tips, col='day', height=4, aspect=1)
plt.show()

Residual plot

sns.residplot(x='hours', y='score', data=tips, lowess=True, color='green')
plt.title('Residual Plot')
plt.show()

Polynomial regression (degree=2)

sns.lmplot(x='hours', y='score', data=tips, order=2, ci=None, line_kws={'color':'purple'})
plt.show()

Interpreting the plots

  • Slope indicates direction/magnitude of relationship.
  • Confidence interval (shaded area) shows uncertainty.
  • Residuals help assess model fit; random scatter suggests a good fit.

Info

Seaborn uses statsmodels under the hood for advanced regression options.

Previous: Seaborn Categorical Plots: Bar, Box, and ViolinNext: Heatmaps and Pairplots for Correlation Analysis