seaborn.violinplot
seaborn.violinplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, bw='scott', cut=2, scale='area', scale_hue=True, gridsize=100, width=0.8, inner='box', split=False, dodge=True, orient=None, linewidth=None, color=None, palette=None, saturation=0.75, ax=None, **kwargs)
小栗子
tips = sns.load_dataset('tips')
ax = sns.violinplot(x=tips['tip'])

和boxplot用起来差不多,这里,我们只传入了X轴,所以就从X轴来展示
这个组合图,中间白点是中位数,中间是箱线图
从密度图中看,大部分数据都集中在中位数附近
ax = sns.violinplot(y=tips['tip'])

我们可以和箱线图对比下
ax = sns.boxplot(y=tips['tip'])

ax = sns.violinplot(x='time' , y='tip' , data=tips)

ax = sns.violinplot(x='day' , y='tip' , hue='time' , data=tips)

网友评论