How to make an all-vs-one group of scatterplots - a list of columns against one target column

matplotlib, pandas

Solution

You could try using seaborn pairplot, and passing specific x and y variables.

import seaborn as sns
sns.pairplot(df, y_vars="A", x_vars=df.columns.values)

Problem

I want to plot a bunch of variables against the same target variable. So a kind of scatter matrix, but with list_of_df_columns-vs-one_df_column rather than all-vs-all. I've looked at adding subplots one by one in a loop, but it seems like there must be a better way. Is there some way to use the scatter_matrix function to do this? There are dozens of variables I want to plot against a single outcome, I really want the results to be nice and compact so they can be presented as a single figure.

Original source