⼩⽩学Python(13)——pyecharts绘制柱状图条形图Bar Bar-基本⽰例
1from examplemons import Faker
2from pyecharts import options as opts
3from pyecharts.charts import Bar
4
5 bar=(
6 Bar()
7 .add_xaxis(Faker.choose())
8 .add_yaxis("商家A", Faker.values())
9 .add_yaxis("商家B", Faker.values())
10 .set_global_opts(title_opts=opts.TitleOpts(title="Bar-基本⽰例", subtitle="我是副标题"))
11 )
12
der()
翻转 XY 轴
1from examplemons import Faker
2from pyecharts import options as opts
3from pyecharts.charts import Bar
4
5 bar=(
6 Bar()
7 .add_xaxis(Faker.choose())
8 .add_yaxis("商家A", Faker.values())
9 .add_yaxis("商家B", Faker.values())
10 .reversal_axis()
11 .set_series_opts(label_opts=opts.LabelOpts(position="right"))
12 .set_global_opts(title_opts=opts.TitleOpts(title="Bar-翻转 XY 轴"))
13 )
14
der()
Bar-堆叠数据(全部)
1from examplemons import Faker
2from pyecharts import options as opts
3from pyecharts.charts import Bar
4
5 bar=(
6 Bar()
7 .add_xaxis(Faker.choose())
8 .add_yaxis("商家A", Faker.values(), stack="stack1")
9 .add_yaxis("商家B", Faker.values(), stack="stack1")
10 .set_series_opts(label_opts=opts.LabelOpts(is_show=False))
11 .set_global_opts(title_opts=opts.TitleOpts(title="Bar-堆叠数据(全部)"))
12 )
13
der()
Bar-MarkPoint(指定类型)
1from examplemons import Faker
2from pyecharts import options as opts
3from pyecharts.charts import Bar
4
5 bar=(
6 Bar()
7 .add_xaxis(Faker.choose())
8 .add_yaxis("商家A", Faker.values())
9 .add_yaxis("商家B", Faker.values())
10 .set_global_opts(title_opts=opts.TitleOpts(title="Bar-MarkPoint(指定类型)"))
programm11 .set_series_opts(
12 label_opts=opts.LabelOpts(is_show=False),
13 markpoint_opts=opts.MarkPointOpts(
14 data=[
15 opts.MarkPointItem(type_="max", name="最⼤值"),
16 opts.MarkPointItem(type_="min", name="最⼩值"),
17 opts.MarkPointItem(type_="average", name="平均值"),
小白学python买什么书18 ]
19 ),
20 )
21 )
22
der()
Bar-DataZoom(slider-⽔平)
1from examplemons import Faker
2from pyecharts import options as opts
3from pyecharts.charts import Bar
4
5 bar=(
6 Bar()
7 .add_xaxis(Faker.days_attrs)
8 .add_yaxis("商家A", Faker.days_values)
9 .set_global_opts(
10 title_opts=opts.TitleOpts(title="Bar-DataZoom(slider-⽔平)"),
11 datazoom_opts=opts.DataZoomOpts(),
12 )devops证书含金量
13 )
14
der()
存储过程批量插入数据Bar-DataZoom(slider-垂直)
1from examplemons import Faker
flask框架特点2from pyecharts import options as opts
3from pyecharts.charts import Bar
4
5 bar=(
6 Bar()
7 .add_xaxis(Faker.days_attrs)
8 .add_yaxis("商家A", Faker.days_values, color=Faker.rand_color())
9 .set_global_opts(
10 title_opts=opts.TitleOpts(title="Bar-DataZoom(slider-垂直)"),
11 datazoom_opts=opts.DataZoomOpts(orient="vertical"),
12 )
13 )
aspects是什么意思英语14
der()
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论