Scatter Plot using Lmplot Function of Seaborn

Apart from the methods scatterplot and regplot, seaborn also provides lmplot as another function to draw a scatterplot.

However when we create scatter plots using seaborn’s lmplot, it will introduce a regression line in the plot.

Let us first import libraries and load the data required to create the plot.

import numpy as np
import pandas as pd
import seaborn as sns
df = pd.read_csv('Seaborn-ScatterPlot-Data.csv')
df.head()
scatter plot using lmplot and seaborn
scatter plot using lmplot and seaborn

Then lets use the below code to draw lmplot.

sns.lmplot(x='Area', y='Price', data=df)  
scatter plot using lmplot and seaborn
scatter plot using lmplot and seaborn

Note that lmplot produces a regression line in the graph as shown above.

Cheers !!

Leave a Reply

%d