You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何可视化Extra与Standard的日均浏览量优势?

最简可视化Extra相对Standard浏览量优势的方案

你当前采用85分位数分组统计+柱状图的思路很合理,能有效规避极端值干扰,不过可以优化得更直观,直接突出相对优势,以下是几种简洁实现方式:

1. 分位数柱状图+差值标注

直接在图上标注Extra相对Standard的优势比例,一眼就能看出差距:

# 计算两组的85分位数
quant_stats = df.groupby('status')['views_per_day'].quantile(0.85)
# 计算相对优势百分比
advantage_pct = (quant_stats['Extra'] / quant_stats['Standard'] - 1) * 100
# 绘制柱状图
ax = quant_stats.plot(kind='bar', rot=0)
ax.set_ylabel('日均浏览量(85分位数)')
ax.set_title(f'Extra相对Standard浏览量优势:{advantage_pct:.1f}%')
# 在柱子上方标注具体数值
for patch in ax.patches:
    ax.annotate(f'{patch.get_height():.0f}',
                (patch.get_x() + patch.get_width()/2, patch.get_height()),
                ha='center', va='bottom')

2. 归一化对比(以Standard为基准)

把Standard的浏览量设为100基准,直接展示Extra的相对倍数,优势更直观:

quant_stats = df.groupby('status')['views_per_day'].quantile(0.85)
# 归一化到Standard的数值
normalized = quant_stats / quant_stats['Standard'] * 100
normalized.plot(kind='bar', rot=0, legend=False)
plt.ylabel('相对日均浏览量(Standard=100)')
plt.title('Extra相对Standard的浏览量优势')

补充:展示整体分布的方案

如果想体现两组的整体数据分布而非单一分位数,箱线图是更合适的选择:

df.boxplot(column='views_per_day', by='status')
plt.title('日均浏览量分布对比')
plt.suptitle('')  # 移除pandas默认的顶部标题

内容的提问来源于stack exchange,提问作者Barry the Platipus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 01:31:08