最近学了一点python关于pyecharts的内容,发现一篇内容挺全的文章,转一下。
一、 安装
pip install pyecharts
二、pyecharts柱状图/条形图全解
1.基本柱状图/条形图
from pyecharts import options as opts
from pyecharts.charts import Bar
l1=['星期一','星期二','星期三','星期四','星期五','星期七','星期日']
l2=[100,200,300,400,500,400,300]
bar = (
Bar()
.add_xaxis(l1)
.add_yaxis("基本柱状图", l2)
.set_global_opts(title_opts=opts.TitleOpts(title="Bar-基本示例", subtitle="我是副标题"))
)
# 生成render.html查看表格
bar.render()
参数介绍:
add_xaxis:添加横坐标,需传入列表
add_yaxis:添加纵坐标,需传入列表,切列表元素为数值
2.添加坐标轴名称
from pyecharts import options as opts
from pyecharts.charts import Bar
l1=['星期一','星期二','星期三','星期四','星期五','星期七','星期日']
l2=[100,200,300,<