5
我有Facetgrid一個問題:當我使用色調參數,在X-標籤以錯誤的順序顯示,不匹配的數據。加載泰坦尼克號數據集的IPython:色調參數FacetGrid
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
titanic = sns.load_dataset("titanic")
g = sns.FacetGrid(titanic, col='pclass', hue='survived')
g = g.map(sns.swarmplot, 'sex', 'age')
Facetgrid與色調:
從這一點看來,有比男性更多的女性,但事實卻並非如此。
如果現在去掉色調選項,然後我得到一個正確的分佈:有比所有pclasses女性多男性。
g = sns.FacetGrid(titanic, col='pclass')
g = g.map(sns.swarmplot, 'sex', 'age')
Facetgrid無色相:
這是怎麼回事嗎? 我使用Seaborn 0.7.0
大,這使得它明確。謝謝 – PeerEZ