Bar - Bar_rotate_xaxis_label
解决标签名字过长的问题
from pyecharts import options as opts
from pyecharts.charts import Bar
c = (
Bar()
.add_xaxis(
[
"高等数学1,2",
"C语言程序设计",
"python程序设计",
"大数据导论",
"数据结构",
"大数据与人工智能",
]
)
.add_yaxis("大一的学习效率", [10, 20, 30, 40, 50, 40])
.add_yaxis("大二的学习效率", [20, 10, 40, 30, 40, 50])
.set_global_opts(
xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=-15)), #此行代码旋转标签的角度
title_opts=opts.TitleOpts(title="信阳农林学院信息工程学院", subtitle="数据科学与大数据技术21-2"),
)
.render("bar_rotate_xaxis_label.html")
)
Awesome-pyecharts
Bar - Bar_stack0
叠层柱状图
可以求比例
from pyecharts import options as opts
from pyecharts.charts import Bar
from pyecharts.faker import Faker
c = (
Bar()
.add_xaxis(
[
"高等数学1,2",
"C语言程序设计",
"python程序设计",
"大数据导论",
"数据结构",
"大数据与人工智能",
]
)
.add_yaxis("大一的学习效率", [10, 20, 30, 40, 50, 40],stack="stack1") # stack="stack1" 表示同一列
.add_yaxis("大二的学习效率", [20, 30, 50, 60, 70, 80],stack="stack1") #
.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
.set_global_opts(
xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=-15)),
title_opts=opts.TitleOpts(title="信息工程学院学习知识所占百分比")
)
.render("bar_stack0.html")
)
Awesome-pyecharts