GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Python Tutorial
  • Data Types
  • Interview Questions
  • Examples
  • Quizzes
  • DSA Python
  • Data Science
  • NumPy
  • Pandas
  • Practice
  • Django
  • Flask
  • Introduction1 min read
  • Input & Output2 min read

This view

  • Original page
  • New address

GeezerVison is showing www.geeksforgeeks.org — Python - seaborn.residplot() method - GeeksforGeeks

geeksforgeeks
search icon
  • Courses
  • Tutorials
  • Interview Prep
  • Python Tutorial
  • Data Types
  • Interview Questions
  • Examples
  • Quizzes
  • DSA Python
  • Data Science
  • NumPy
  • Pandas
  • Practice
  • Django
  • Flask

Python - seaborn.residplot() method

Last Updated : 15 Jul, 2025

Seaborn is an amazing visualization library for statistical graphics plotting in Python. It provides beautiful default styles and color palettes to make statistical plots more attractive. It is built on the top of matplotlib library and also closely integrated to the data structures from pandas.

seaborn.residplot() :

This method is used to plot the residuals of linear regression. This method will regress y on x and then draw a scatter plot of the residuals. You can optionally fit a lowess smoother to the residual plot, which can help in determining if there is a structure to the residuals.

Syntax: seaborn.residplot(x, y, data=None, lowess=False, x_partial=None, y_partial=None, order=1,
   robust=False, dropna=True, label=None, color=None, scatter_kws=None, line_kws=None, ax=None)

Parameters: The description of some main parameters are given below:

  • x: Data or column name in 'data' for the predictor variable.
  • y: Data or column name in 'data' for the response variable.
  • data: (optional) DataFrame having `x` and `y` are column names.
  • lowess: (optional) Fit a lowess smoother to the residual scatterplot.
  • dropna: (optional) This parameter takes boolean value. If True, ignore observations with missing data when fitting and plotting.

Return: Axes with the regression plot.

Below is the implementation of above method:

Example 1:

Python3
# importing required packages
import seaborn as sns
import matplotlib.pyplot as plt

# loading dataset
data = sns.load_dataset("tips")

# draw residplot
sns.residplot(x = "total_bill",
              y = "tip",
              data = data)

# show the plot
plt.show()

# This code is contributed
# by Deepanshu Rustagi.

Output:

Example 2:

Python3
# importing required packages
import seaborn as sns
import matplotlib.pyplot as plt

# loading dataset
data = sns.load_dataset("iris")

# draw residplot
# with lowess = True
sns.residplot(x = "petal_length",
              y = "petal_width",
              data = data,
              lowess = True)

# show the plot
plt.show()

# This code is contributed
# by Deepanshu Rustagi.

Output:

Comment

Explore

    Python Fundamentals
    • Introduction1 min read
    • Input & Output2 min read
    • Variables4 min read
    • Operators4 min read
    • Keywords2 min read
    • Data Types4 min read
    • Conditional Statements3 min read
    • Loops3 min read
    • Functions4 min read
    Python Data Structures
    • String4 min read
    • List3 min read
    • Tuples3 min read
    • Dictionary3 min read
    • Set2 min read
    • Arrays5 min read
    Advanced Python
    • OOP Concepts3 min read
    • Exception Handling5 min read
    • File Handling4 min read
    • Python Database2 min read
    • MongoDB3 min read
    • MySQL7 min read
    • Packages4 min read
    • Modules3 min read
    • DSA Libraries5 min read
    • Python GUI2 min read
    Data Science with Python
    • Numpy3 min read
    • Pandas4 min read
    • Matplotlib3 min read
    • Seaborn3 min read
    • StatsModel2 min read
    • Model Building6 min read
    • TensorFlow2 min read
    • PyTorch5 min read
    Web Development with Python
    • Flask3 min read
    • Django5 min read
    • Django ORM4 min read
    • Jinja2 Templating5 min read
    • Django Templates5 min read
    • REST API3 min read
    • Build API with DRF4 min read
    Python Practice
    • Quiz1 min read
    • Practice Problems2 min read
    • Interview Q & A15+ min read
    Courses
    • Placement 360 Course2 min read
    • Data Science 360 Course2 min read
    • AI Engg Course2 min read
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.