在 matplotlib 和 seaborn 上,如何将 kdeplot 上的 y 轴切换为测量计数而不是测量密度?

问题描述

在 histplot 上,有一个 stat='' 参数可以做我想做的事。使用 histplot 的问题是我只想要 kde 而不是直方图。我该如何解决这个问题?注意:我不是要我们 PercentFormatter 来计算概率。我只是想得到计数。 This is what the kdeplot currently looks like.

解决方法

试试: sns.distplot(data=tips,x='total_bill',hue='smoker',stat="count")