有没有办法在distplot上绘制百分比而不是计数
ax = sns.FacetGrid(telcom, hue='Churn', palette=["teal", "crimson"], size=5, aspect=1)
ax = ax.map(sns.distplot, "tenure", hist=True, kde=False)
ax.fig.suptitle('Tenure distribution in customer churn', y=1, fontsize=16, fontweight='bold');
plt.legend();
您可以使用
norm_hist = True
从documentation开始:
stat
参数。使用stat='percent'
李>common_bins
和common_norm
进行试验。common_norm=True
将显示占整个人口的百分比,而False
将显示相对于群体的百分比李>图形级别
labels
中使用的类型批注(:=
)需要python >= 3.8
。这可以通过for-loop
实现,而无需使用:=
李>轴水平
您可以选择一个条形图,并设置一个估计器,以百分比定义标准化:
给予:
相关问题 更多 >
编程相关推荐