官方文档
简介 - pyecharts - A Python Echarts Plotting Library built with love.
先绘制个雷达图
import pyecharts.options as opts
from pyecharts.charts import Radar
from pyecharts.faker import Faker
radar = (
# 雷达图
Radar(
# 初始化配置项
init_opts=opts.InitOpts(
theme='dark' # 图表主题 white dark
)
)
# !!!!全局配置项!!!!
.set_global_opts(
# 标题配置项
title_opts=opts.TitleOpts(
title="雷达图", # 主标题
)
)
# 指示器配置
.add_schema(
schema=[
opts.RadarIndicatorItem(name="生命"),
opts.RadarIndicatorItem(name="攻击"),
opts.RadarIndicatorItem(name="防御"),
opts.RadarIndicatorItem(name="精通"),
opts.RadarIndicatorItem(name="暴击率"),
opts.RadarIndicatorItem(name="暴击伤害"),
opts.RadarIndicatorItem(name="充能")
]
)
# 数据配置
.add(
# 系列名称,用于 tooltip 的显示,legend 的图例筛选
series_name='英雄一',
# 系列数据项
data=[Faker.values()],
# 系列颜色
color="red"
)
.add(
series_name='英雄二',
data=[Faker.values()],
color="blue"
)
)
radar.render("test8.html")
运行一下看下结果
以上就是雷达图的绘制,不懂的可以看一下之前的博客,更多配置请移至官方文档。