A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/python-seaborn-regplot-method/ below:

Python - seaborn.regplot() method - GeeksforGeeks

Python - seaborn.regplot() method

Last Updated : 15 Jul, 2025

Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. Seaborn helps resolve the two major problems faced by Matplotlib; the problems are ?

As Seaborn compliments and extends Matplotlib, the learning curve is quite gradual. If you know Matplotlib, you are already half-way through Seaborn.

seaborn.regplot() :

This method is used to plot data and a linear regression model fit. There are a number of mutually exclusive options for estimating the regression model. For more information click here.

Syntax : seaborn.regplot( x,  y,  data=None, x_estimator=None, x_bins=None,  x_ci='ci', scatter=True, fit_reg=True, ci=95, n_boot=1000, units=None, order=1, logistic=False, lowess=False, robust=False, logx=False, x_partial=None, y_partial=None, truncate=False, dropna=True, x_jitter=None, y_jitter=None, label=None, color=None, marker='o',    scatter_kws=None, line_kws=None, ax=None)

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

Return: The Axes object containing the 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("mpg")

# draw regplot
sns.regplot(x = "mpg", 
            y = "acceleration", 
            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("titanic")

# draw regplot
sns.regplot(x = "age",
            y = "fare",
            data = data,
            dropna = True)
# show the plot
plt.show()

# This code is contributed 
# by Deepanshu Rustagi.

Output :

Example 3:

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

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

# draw regplot
sns.regplot(x = "id",
            y = "pulse", 
            data = data)

# show the plot
plt.show()

# This code is contributed 
# by Deepanshu Rustagi.

Output :

Example 4 :

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

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

# draw regplot
sns.regplot(x = "solutions",
            y = "score",
            data = data)

# show there plot
plt.show()

# This code is contributed 
# by Deepanshu Rustagi.

Output :



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4