赞
踩
pyecharts的radar类表示为雷达图,该类中提供了class radar()配置项和def add_schema()的各种配置项,以下为这两项的函数用法:
- class Radar(
- # 初始化配置项,参考 `global_options.InitOpts`
- init_opts: opts.InitOpts = opts.InitOpts()
- )
- def add_schema(schema: Sequence[Union[opts.RadarIndicatorItem, dict]], shape: Optional[str] = None,center: Optional[types.Sequence] = None, radius: types.Optional[types.Union[types.Sequence, str]] = None, start_angle: types.Numeric = 90,
- textstyle_opts: Union[opts.TextStyleOpts, dict] = opts.TextStyleOpts(),
- splitline_opt: Union[opts.SplitLineOpts, dict] = opts.SplitLineOpts(is_show=True),
- splitarea_opt: Union[opts.SplitAreaOpts, dict] = opts.SplitAreaOpts(),axisline_opt: Union[opts.AxisLineOpts, dict] = opts.AxisLineOpts(),
- radiusaxis_opts: types.RadiusAxis = None, angleaxis_opts: types.AngleAxis = None, polar_opts: types.Polar = None)
该函数的常用含义如下:
- def add(series_name: str,data: types.Sequence[types.Union[opts.RadarItem, dict]],
- is_selected: bool = True,symbol: Optional[str] = None,color: Optional[str] = None,
- label_opts: opts.LabelOpts = opts.LabelOpts(),linestyle_opts: opts.LineStyleOpts = opts.LineStyleOpts(),areastyle_opts: opts.AreaStyleOpts = opts.AreaStyleOpts(),
- tooltip_opts: Union[opts.TooltipOpts, dict, None] = None)
该函数的含义如下:
例题:
- v1 = [[33, 45, 3, 9,6, 4]]
-
- x_schema = [
- {"name": "化学药", "color": 'black', "font_size": 18},
- {"name": "中成药", "color": 'black', "font_size": 18},
- {"name": "生物制品", "color": 'black', "font_size": 18},
- {"name": "中药饮片", "color": 'black', "font_size": 18},
- {"name": "保健品", "color": 'black', "font_size": 18}
- ]
-
- radar_x = Radar()
- radar_x.add_schema(x_schema,shape="circle")
- radar_x.add('药品', v1, color='red').set_colors(['red'])
-
- radar_x.set_global_opts(
- title_opts=op.TitleOpts(title="全国药店药品销售额占比", pos_right="center"),
- legend_opts=op.LegendOpts(legend_icon="roundRect", align="left", pos_left='7%',
- pos_bottom='14%', orient='vertical')
- )
运行结果:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。