Regression Plots in Seaborn

Intermediate Data Visualization with Seaborn

Chris Moffitt

Instructor

Introduction to regplot

  • The regplot function generates a scatter plot with a regression line
  • Usage is similar to the displot
  • The data and x and y variables must be defined
sns.regplot(data=df, x="alcohol", y="pH" )

Scatter plot

Intermediate Data Visualization with Seaborn

lmplot() builds on top of the base regplot()

  • regplot - low level
sns.regplot(data=df,
            x="alcohol",
            y="quality")

Wine quality plot

  • lmplot - high level
sns.lmplot(data=df, 
           x="alcohol",
           y="quality")

Wine quality plot

Intermediate Data Visualization with Seaborn

lmplot faceting

  • Organize data by colors (hue)
sns.lmplot(data=df, 
           x="quality",
           y="alcohol",
           hue="type")

Wine quality plot with hue

  • Organize data by columns (col)
sns.lmplot(data=df, 
           x="quality",
           y="alcohol",
           col="type")

Wine quality with column

Intermediate Data Visualization with Seaborn

Let's practice!

Intermediate Data Visualization with Seaborn

Preparing Video For Download...