我不得不follow the instructions posted here創建散點圖矩陣,使用多種顏色來區分我的數據集(this seems to still be on open issue)中的處理。爲什麼在包含在Seaborn PairGrid中時kdeplot會縮小y軸?
我的問題是,一些我的KDE次要情節是關閉的Y軸比例:Leaf area index PairGrid
這似乎並沒有被那麼嚴重使用「光圈」數據集的問題,但我還是看到它發生在第二,第三和第四個子圖(see the PairGrid in this post)。
如何調整y軸縮放比例,以便我的所有kde數據都適合子插槽?
import matplotlib.pyplot as plt
import seaborn as sns
iris = sns.load_dataset("iris")
g = sns.PairGrid(iris, hue='species', size=2)
def f(x, **kwargs):
kwargs.pop("color")
col = next(plt.gca()._get_lines.prop_cycler)['color']
sns.kdeplot(x, color=col, **kwargs)
g.map_diag(f)
g.map_offdiag(plt.scatter)
g.add_legend()
plt.show()
鏈接的問題確實有[mcve]。爲什麼要發佈不可重現的代碼而不是使用可用的代碼? – ImportanceOfBeingErnest
我在輸出中包含了一個截圖的鏈接,並認爲從原始代碼發佈在我引用的其他帖子中顯示我使用的代碼是合適的。我對這種明顯的困惑表示歉意。 –