#客户价值雷达图
temp = kmeansResult
#分别取出不同群体的特征值
customer1 = [temp.iloc[0,2:].values.tolist()]
customer2 = [temp.iloc[1,2:].values.tolist()]
customer3 = [temp.iloc[2,2:].values.tolist()]
customer4 = [temp.iloc[3,2:].values.tolist()]
customer5 = [temp.iloc[4,2:].values.tolist()]
r = kmeansCenters
max = r.values.max()
min = r.values.min()
#背景分割线颜色
split_line_style = {'color': [
'#000000', '#000000',
'#000000', '#000000',
'#000000', '#000000'
][::-1]
}
radar = Radar(init_opts=opts.InitOpts(theme='light', height='500px', width='700px'))
radar.add_schema(shape='circle',
textstyle_opts=opts.TextStyleOpts(color='#000000'),
axisline_opt=opts.LineStyleOpts(is_show=True, color='#000000'),
splitline_opt=opts.SplitLineOpts(is_show=True, linestyle_opts=split_line_style),
schema=[opts.RadarIndicatorItem(name='ZL',min_=min-0.1, max_=max+0.1),
opts.RadarIndicatorItem(name='ZR',min_=min-0.1, max_=max+0.1),
opts.RadarIndicatorItem(name='ZF',min_=min-0.1, max_=max+0.1),
opts.RadarIndicatorItem(name="ZM",min_=min-0.1, max_=max+0.1),
opts.RadarIndicatorItem(name="ZC",min_=min-0.1, max_=max+0.1),
])
radar.add('群体1', customer1, symbol='none',
label_opts=opts.LabelOpts(is_show=True),
linestyle_opts=opts.LineStyleOpts( color='#9b47b0',width=2, opacity=0.6),
areastyle_opts=opts.AreaStyleOpts( color='#9b47b0',opacity=0.1))
radar.add('群体2', customer2, symbol='none',
label_opts=opts.LabelOpts(is_show=True),
linestyle_opts=opts.LineStyleOpts(color='#3b577d', width=2),
areastyle_opts=opts.AreaStyleOpts(color='#3b577d', opacity=0.05))
radar.add('群体3', customer3, symbol='none',
label_opts=opts.LabelOpts(is_show=True),
linestyle_opts=opts.LineStyleOpts(color='#e1306c', width=2, opacity=0.6),
areastyle_opts=opts.AreaStyleOpts(color='#e1306c',opacity=0.05))
radar.add('群体4', customer4, symbol='none',
label_opts=opts.LabelOpts(is_show=True),
linestyle_opts=opts.LineStyleOpts(color='#f77737', width=2, opacity=0.6),
areastyle_opts=opts.AreaStyleOpts(color='#f77737',opacity=0.05))
radar.add('群体5', customer5, symbol='none',
label_opts=opts.LabelOpts(is_show=True),
linestyle_opts=opts.LineStyleOpts(color='#4285f4', width=2, opacity=0.6),
areastyle_opts=opts.AreaStyleOpts(color='#4285f4',opacity=0.05))
radar.set_global_opts(legend_opts=opts.LegendOpts(is_show=True, selected_mode='flase', pos_bottom=5),
title_opts=opts.TitleOpts(title="客户价值雷达图", pos_left='center',
title_textstyle_opts=opts.TextStyleOpts(font_size=20,color='#000000')))
radar.render_notebook()
如何设置图中的展示色和标签的颜色相对应?