Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Pandas
  • Matplotlib
  • Plotly
  • Altair
  • Bokeh
  • Data Analysis
  • R
  • Machine Learning Math
  • Machin Learning
  • Deep Learning
  • Deep Learning Projects
  • NLP
  • Computer vision
  • Data science
  • Deep learning interview question
  • Machin Learning Interview question
Open In App
Next Article:
Python - seaborn.lmplot() method
Next article icon

Python – seaborn.regplot() method

Last Updated : 23 Jan, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

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 ?

  • Default Matplotlib parameters
  • Working with data frames

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:

  • x, y: These are Input variables. If strings, these should correspond with column names in “data”. When pandas objects are used, axes will be labeled with the series name.
  • data:  This is dataframe where each column is a variable and each row is an observation.
  • lowess: (optional) This parameter take boolean value. If “True”, use “statsmodels” to estimate a nonparametric lowess model (locally weighted linear regression).
  • color: (optional) Color to apply to all plot elements.
  • marker: (optional) Marker to use for the scatterplot glyphs.

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 :



Next Article
Python - seaborn.lmplot() method

D

deepanshu_rustagi
Improve
Article Tags :
  • Python
  • Python-Seaborn
Practice Tags :
  • python

Similar Reads

  • Python - seaborn.residplot() method
    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. sea
    2 min read
  • Python Seaborn.saturate() method
    Python saturate() method allows users to adjust the saturation level of colors in plots. In this article, we will discuss in details of the saturate() method, exploring its functionality and how it can be effectively utilized in data visualization tasks. What is the saturate() Method?The saturate()
    2 min read
  • Python - seaborn.lmplot() method
    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. sea
    7 min read
  • Python - seaborn.pointplot() method
    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. sea
    3 min read
  • Python - seaborn.pairplot() method
    seaborn.pairplot() method is used for visualizing relationships between multiple variables in a dataset. By creating a grid of scatter plots it helps to identify how different features interact with each other to identify patterns, correlations and trends in data. In this article, we will see how to
    3 min read
  • Python - seaborn.boxenplot() method
    Prerequisite : Fundamentals of Seaborn Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. There is just something extraordinary about a well-designed visualization. The colors stand out,
    3 min read
  • Python - seaborn.jointplot() method
    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 ? Default Matplotlib parametersWorking with data fram
    3 min read
  • Python - seaborn.swarmplot() method
    Prerequisite : Fundamentals of Seaborn Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. There is just something extraordinary about a well-designed visualization. The colors stand out,
    3 min read
  • Seaborn.barplot() method in Python
    Seaborn is a Python data visualization library based on Matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. There is just something extraordinary about a well-designed visualization. The colors stand out, the layers blend nicely together, the c
    4 min read
  • Python Seaborn.desaturate() Method
    Python Seaborn desaturate() is a method designed to control the saturation levels of colors in plots. In this article, we will discuss about the desaturate() method, exploring its functionality and how it can be effectively utilized in data visualization tasks. What is desaturate() Method in Python
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences