如何在Python中堆叠Seapair Pairgrids

问题描述 投票:1回答:1

我正在创建一个pairgrid,它将多个因变量与一个自变量进行比较。我有一个情节,这正是我想要的方式,除了一件事:我不希望情节排成一列。

这是我的代码:

g = sns.PairGrid(df, y_vars=["W%"], x_vars=["PPG", "FG%", "3FG%", "FT%", 'APG', 'TOPG', 'RPG'], height=4)
g.map(sns.regplot, color=".3")
plt.ylim(0, 1)

这是输出。我真的想以某种方式堆叠它们,第二行还包含y轴和刻度。很明显,我可以运行另一个具有不同变量的对图,但是我希望它们都在同一根轴上。我不在乎它们是如何堆叠的,2x2x2x1、3x3x2、4x3,任何有效的方法。我只想弄清楚怎么做。我打算制作一个子图,但是sns.PairGrid()没有斧头参数。谢谢!

编辑:我也想知道如何使整个pairgrid更大。enter image description here

python pandas matplotlib data-visualization seaborn
1个回答
0
投票

col_wrapheight参数用于sns.FacetGrid

摘自seaborn教程https://seaborn.pydata.org/tutorial/axis_grids.html

attend = sns.load_dataset("attention").query("subject <= 12")
g = sns.FacetGrid(attend, col="subject", col_wrap=4, height=2, ylim=(0, 10))
g.map(sns.pointplot, "solutions", "score", order=[1, 2, 3], color=".3", ci=None);
© www.soinside.com 2019 - 2024. All rights reserved.