Regression Plots
Regression is a technique in which we estimate the relationship between a dependent variable (mostly plotted along the Y – axis) and an independent variable (mostly plotted along the X – axis). Given a dataset, we can assign independent and dependent variables and then use various regression methods to find out the relation between these variables. Here, we will only cover linear regression; however, Seaborn provides a wider range of regression functionality if needed.
The regplot()
function offered by Seaborn helps to visualize linear relationships, determined through linear regression. The following code snippet gives a simple example:
import numpy as np import seaborn as sns x = np.arange(100) # normal distribution with mean 0 and a standard deviation of 5 y = x + np.random.normal(0, 5, size=100) sns.regplot(x, y)
The regplot()
function draws a scatter plot, a regression line, and a 95% confidence interval for that regression, as shown in...