<分区>
我想为我的 DataFrame 中的所有列绘制成对图;然而,我想生成 hexbin 图而不是散点图(这样我可以更好地看到点的密度)。
sns.pairplot 没有这个选项,我想知道怎么可能?
<分区>
我想为我的 DataFrame 中的所有列绘制成对图;然而,我想生成 hexbin 图而不是散点图(这样我可以更好地看到点的密度)。
sns.pairplot 没有这个选项,我想知道怎么可能?
最佳答案
Paitplot 在一个 Canvas 上为所有可能的变量对绘制两种类型的图
diag_kind 来设置它:{‘auto’, ‘hist’, ‘kde’}, optional
kind : {‘scatter’, ‘reg’}, optional
See here for more information.
你想要什么样的情节,你需要使用sns.jointplot
。您可以按照@cripcate 在评论中的建议使用它。
import numpy as np
import seaborn as sns
%matplotlib inline #extra attention at this line
sns.set(style="ticks")
rs = np.random.RandomState(11)
x = rs.gamma(2, size=1000)
y = -.5 * x + rs.normal(size=1000)
sns.jointplot(x, y, kind="hex", color="#4CB391")
关于python - 使用 hexbin 的 Pairplot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56078200/