Seaborn | Regression Plots

Last Updated : 26 Jun, 2026

Regression plots in Seaborn are used to visualize the relationship between two continuous variables along with a fitted regression line. They are commonly used in exploratory data analysis to identify patterns, trends, and the nature of correlation between variables.

  • Displays both data distribution (scatter points) and trend estimation (regression line) in a single view
  • Supports quick comparison of relationships across different subsets of data using categorical grouping

To demonstrate regression plots, we first load a sample dataset and import the required library.

Python
import seaborn as sns

dataset = sns.load_dataset('tips')

dataset.head()

Output:

Types of Regression Plots

1. Simple Regression Plot

We use lmplot() to visualize the relationship between total bill and tip along with a regression line.

Python
sns.set_style('whitegrid')
sns.lmplot(x ='total_bill', y ='tip', data = dataset)

Output:

2. Regression Plot with Categories (hue)

This adds categorical separation to the plot using gender (sex), allowing comparison between groups.

  • hue separates data into categories
  • markers assigns different shapes for each category
Python
sns.set_style('whitegrid')
sns.lmplot(x ='total_bill', y ='tip', data = dataset, 
           hue ='sex', markers =['o', 'v'])

Output:

3. Customized Regression Plot

We modify the appearance of the plot using point size and color palette for better visualization.

  • scatter_kws controls scatter point size
  • palette changes color scheme
  • Regression line remains unchanged
Python
sns.set_style('whitegrid')
sns.lmplot(x ='total_bill', y ='tip', data = dataset, hue ='sex', 
           markers =['o', 'v'], scatter_kws ={'s':100}, 
           palette ='plasma')

Output:

4. Multiple Regression Plots

We create multiple plots using categorical separation across rows and columns.

  • col splits plots by gender
  • row splits plots by time (lunch/dinner)
  • hue adds smoking category comparison
Python
sns.lmplot(x ='total_bill', y ='tip', data = dataset, 
           col ='sex', row ='time', hue ='smoker')

Output:

5. Size and Aspect Control

We adjust plot dimensions for better readability when multiple plots are generated.

  • aspect controls width-to-height ratio
  • height controls plot size
  • Useful for multi-plot layouts
Python
sns.lmplot(x ='total_bill', y ='tip', data = dataset, col ='sex', 
           row ='time', hue ='smoker', aspect = 0.6, 
           height = 4, palette ='coolwarm')

Output:

Applications

  • Used in exploratory data analysis (EDA) to identify correlation patterns between continuous variables
  • Helps in understanding trends such as how one variable changes with respect to another (e.g., sales vs advertising spend)
  • Useful for comparing relationships across different categories using grouping variables like gender, time, or region
  • Supports model validation by visually checking how well a regression model fits the observed data
Comment