A RetroSearch Logo

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

Search Query:

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

Python - seaborn.lmplot() method - GeeksforGeeks

Python - seaborn.lmplot() 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.Implot() method

seaborn.lmplot() method is used to draw a scatter plot onto a FacetGrid.

Syntax : seaborn.lmplot(x, y, data, hue=None, col=None, row=None, palette=None, col_wrap=None, height=5, aspect=1, markers='o', sharex=True, sharey=True, hue_order=None, col_order=None, row_order=None, legend=True, legend_out=True, x_estimator=None, x_bins=None, x_ci='ci', scatter=True, fit_reg=True, ci=95, n_boot=1000, units=None, seed=None, order=1, logistic=False, lowest=False, robust=False, logx=False, x_partial=None, y_partial=None, truncate=True, x_jitter=None, y_jitter=None, scatter_kws=None, line_kws=None, size=None)

Parameters : This method is accepting the following parameters that are described below: 

Returns : This method returns the FacetGrid object with the plot on it for further tweaking. 
 


Note: For downloading the Tips dataset Click Here.

Below examples illustrate the lmplot() method of seaborn library.

Example 1 : Scatter plot with regression line(by default).  

Python3
# importing the required library
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# read a csv file
df = pd.read_csv('Tips.csv')

# scatter plot with regression 
# line(by default)
sns.lmplot(x ='total_bill', y ='tip', data = df)

# Show the plot
plt.show()

Output : 
 


Example 2 : Scatter plot without regression line. 

Python3
# importing the required library
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# read a csv file
df = pd.read_csv('Tips.csv')

# scatter plot without regression
# line.
sns.lmplot(x ='total_bill', y ='tip',
           fit_reg = False, data = df)

# Show the plot
plt.show()

Output : 


Example 3 : Scatter plot using hue attribute for coloring out points according to the sex. 

Python3
# importing the required library
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# read a csv file
df = pd.read_csv('Tips.csv')

# scatter plot using hue attribute
# for colouring out points
# according to the sex
sns.lmplot(x ='total_bill', y ='tip', 
          fit_reg = False, hue = 'sex',
          data = df)

# Show the plot
plt.show()

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