目录

  • ​​1. 自动轮播图​​
1. 自动轮播图
from pyecharts.charts import Bar, Line, Tab, Timeline
from pyecharts import options

# 1. 准备数据
cate = ["湖北", "四川", "重庆", "河北", "云南"]
Confirmed_diagnosis_data = [450, 300, 232, 224, 144]
death_data = [50, 30, 22, 24, 44]

# 2. 创建图表对象
bar = Bar()
bar.add_xaxis(cate)
bar.add_yaxis("确诊人数", Confirmed_diagnosis_data)
bar.add_yaxis("死亡人数", death_data)
bar.set_global_opts(title_opts=options.TitleOpts(title="柱状图"))

line = Line()
line.add_xaxis(cate)
line.add_yaxis("quezhen人数", Confirmed_diagnosis_data)
line.add_yaxis("siwang人数", death_data)
line.set_global_opts(title_opts=options.TitleOpts(title="折线图"))

# 3. 创建组合类对象
timeline = Timeline()

# 4. 在组合对象中添加需要组合的图表对象

timeline.add(bar, "bar-example")
timeline.add(line, "line-example")

# 5. 渲染数据
timeline.render_notebook()

pyecharts自动轮播图_Line