漏斗图(Funnel),也称为倒三角图,借助echarts的解释如下:
Funnel diagram is suitable for one-way analysis of single process with standardized business process, long cycle
and multiple links.Through comparison of business data of each link in the funnel,the link where the potential problems
can be found intuitively,and then decisions can be made.
在现实应用中,我们常利用此类图形帮助进行业务流程比较规范、周期长、环节多的单流程可视化分析。
场景列举:
用户生命周期模型 —— AARRR(本案例),用于分析用户增长、协助用户运营
电商漏斗模型 —— 如AIPL(Awareness → Interest → Purchase → Loyalty)
用户消费行为模型 —— AIDMA(Attention → Interest → Desire → Memory → Action)
AISAS(Attention → Interest → Search → Action → Share)
ISMAS(Interest → Search → Mouth/口碑 → Action → Share)
SICAS(Sense → interest&interactive → Connect&Communicate → Action → Share)
......
在这样一条从属关系链下,漏斗图反映出来的各环节业务数据缩减比率可以直观说明问题所在的环节,帮助分析者或者管理者做出决策。
由于是模拟数据作图,这里就按照AARRR模型五个环节随机生成数字如下:
环节 | 人数 | 单一环节转化率 | 总体转化率 |
---|---|---|---|
Acquisition | 156280 | 100.00% | 100.00% |
Activation | 93346 | 59.73% | 59.73% |
Retention | 47047 | 50.40% | 30.10% |
Revenue | 10463 | 22.24% | 6.70% |
Referral | 7899 | 75.49% | 5.05% |
import pandas as pd
data = pd.read_excel('漏斗图.xlsx', 'Sheet1')
attrs = data['环节'].tolist()
trans = data['单一环节转化率'].tolist()
attr_value = data['人数'].tolist()
attr_trans = [attrs[i]+"-"+"%.2f%%"%(trans[i]*100) for i in range(5)]
from pyecharts import options as opts
from pyecharts.charts import Funnel
from pyecharts.commons.utils import JsCode
c = (
Funnel(init_opts=opts.InitOpts(theme="essos", bg_color={"type": "pattern", "image": JsCode("img"), "repeat": "repeat"}))
.add_js_funcs( """ var img = new Image();
img.src = '背景2.jpg'; """)
.add("A网站", [list(z) for z in zip(attr_trans, attr_value)],
label_opts=opts.LabelOpts(font_size=13,position="right",formatter="{b}"),
sort_ = 'descending',
gap = 4,
tooltip_opts=opts.TooltipOpts(trigger='item',
formatter="{a}
{b} : {c}",
background_color = "#ffd1df",
border_color = "#ffffd4",
border_width = 4,
textstyle_opts = opts.TextStyleOpts(font_size=14,color='blue'),
)
)
.set_global_opts(title_opts=opts.TitleOpts(title='林老头ss',
subtitle='今天也要加油吖~')
)
.render("漏斗test1.html")
)
import os
os.system("漏斗test1.html")
图形展示:
根据上图,我们可以直观看到单环节转换率较低的为revenue,用户群体中愿意付费享受更多服务的比例较低,基于此我们可以考虑是不是付费会员产品的竞争力不够、费用设置不合理、目标用户不匹配等等,进而优化运营。
本文只展示了基础的funnel函数,随着应用场景不断丰富,绘图多样化需求不断增加,大家可以仅作参考,如果能有所帮助当然最好啦。
下面附上官网的示例,大家自行调参diy
多类漏斗图示例