首页 > 解决方案 > How to plot seaborn pairplot as subplot?

问题描述

I use the following to create my subplots

fig, axs = plt.subplots(2,2)
sns.plotfunc(..., ax = axs[0])

but, the pairplot function in seaborn does not support the ax augment, any idea how to plot it as subplot?

Thanks in advance.

标签: seabornsubplot

解决方案


您可以使用 Seaborn 的PairGrid绘制多个配对图,如下所示:

g = sns.PairGrid(df, y_vars=['variable_a','variable_b'], x_vars=["variable_c", "variable_d"], height=4)
g.map(sns.regplot)
plt.show()

可以在此处找到有关如何使用 PairGrid 的另一个示例。


推荐阅读