Python seaborn,大数据框,做子图
Python seaborn, dataframe big, do subplot
我用 pandas 创建了一个数据框,进一步用 seaborn 生成了一个配对图,效果很好。问题是数据框太大,有 1700 行和 23 列。因此,配对图太小,看不到任何东西。 (另外,文件很大,RAM很忙)。
例如,一个数据框 header 和索引:
A B C ... W
AAA 1 2 3 ... 23
AAB 2 4 6 ...
.
.
.
ZZC 1700 1701 ... 1723
将生成 23*23 的配对图!使用 python 控制台时,我可以强制使用 4 个或更多 plot windows 而不是一个吗?我可以为此使用 matplotlib 吗?如何使用?
Is there any way to tell seaborn to divide the plot into several pieces?
据我所知,不是直接的。
Maybe do subplots (5*5) with matplotlib? Thus, the data is visible?
这听起来像是一个可行的计划,尤其是因为您可能想成为决定哪些数据出现在什么图上的人。这真的不应该花太多精力来实施。 Seaborn 实际上只是 matplotlib 之上的东西,因此您可以像使用任何其他 matplotlib 轴一样使用任何特定于 seaborn 的绘图类型。
答案是 "Yes" 可以,并且您应该使用 FacetGrid
功能。您可以在 this tutorial. And maybe 中阅读相关内容,这将帮助您。
除此之外,除非您提供一些示例数据并更具体地说明您希望输出的内容,否则很难提供代码片段。
我用 pandas 创建了一个数据框,进一步用 seaborn 生成了一个配对图,效果很好。问题是数据框太大,有 1700 行和 23 列。因此,配对图太小,看不到任何东西。 (另外,文件很大,RAM很忙)。
例如,一个数据框 header 和索引:
A B C ... W
AAA 1 2 3 ... 23
AAB 2 4 6 ...
.
.
.
ZZC 1700 1701 ... 1723
将生成 23*23 的配对图!使用 python 控制台时,我可以强制使用 4 个或更多 plot windows 而不是一个吗?我可以为此使用 matplotlib 吗?如何使用?
Is there any way to tell seaborn to divide the plot into several pieces?
据我所知,不是直接的。
Maybe do subplots (5*5) with matplotlib? Thus, the data is visible?
这听起来像是一个可行的计划,尤其是因为您可能想成为决定哪些数据出现在什么图上的人。这真的不应该花太多精力来实施。 Seaborn 实际上只是 matplotlib 之上的东西,因此您可以像使用任何其他 matplotlib 轴一样使用任何特定于 seaborn 的绘图类型。
答案是 "Yes" 可以,并且您应该使用 FacetGrid
功能。您可以在 this tutorial. And maybe
除此之外,除非您提供一些示例数据并更具体地说明您希望输出的内容,否则很难提供代码片段。