Regression plots

We saw that we could use jointplot() to get a regression plot or a residuals plot; naturally, seaborn exposes functions to make these directly without the overhead of creating the entire joint plot. The regplot() function will calculate a regression line and plot it, while residplot() will calculate the regression and plot only the residuals. We can write a function to combine these for us, but first, some setup.

Our function will plot all permutations of any two columns (as opposed to combinations; order matters with permutations, for example, open and close is not the same as close and open). This allows us to see each column as the regressor and as the dependent variable; since we don't know which direction the relationship ...

Get Hands-On Data Analysis with Pandas now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.