common_bins=False
import seaborn as sns
# plot
g = sns.displot(data=df, x='similarity', col='group', col_wrap=2, common_bins=False, height=4)
common_bins=True
(4)
-
sns。置换
和
pandas.DataFrame.plot
具有
kind='hist'
和
bins=4
生成相同的绘图。
g = sns.displot(data=df, x='similarity', col='group', col_wrap=2, common_bins=True, bins=4, height=4)
# reshape the dataframe to a wide format
dfp = df.pivot(columns='group', values='similarity')
axes = dfp.plot(kind='hist', subplots=True, layout=(2, 2), figsize=(9, 9), ec='k', bins=4, sharey=True)