I tried using kind="box" but am not sure if that works. For the example I tried, I got blank subfigures in the non-diagonal parts of the PairGrid.

Edit: Details.

The function I am trying to use is seaborn.pairplot. As mentioned in the link, by default, this function will create a grid of Axes such that each variable in the data parameter will be shared in the y-axis across a single row and in the x-axis across a single column. The diagonal Axes are treated differently, drawing a plot to show the univariate distribution of the data for the variable in that column.

I am looking for a way to make sure that the kind parameter leads to a box plot (seaborn.boxplot) for the non-diagonal parts of the PairGrid.


This wouldn't be possible in seaborn without changing the source code.

pairplot is designed with only two options for the non-diagonal plots: scatter or reg. This can be seen in the source code:

if kind == "scatter":
    plot_kws.setdefault("edgecolor", "white")
    plotter(plt.scatter, **plot_kws)
elif kind == "reg":
    plotter(regplot, **plot_kws)

One option would be copy the source code and create a function similar to pairplot, but with the ability to plot boxplots.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.