项目描述
上传时间
浏览人数
anaconda安装
找到anaconda安装包,双击安装,选项保持默认
在anaconda环境下安装pyecharts
(base) C:\Users\Administrator>pip install pyecharts
3.启动jupyter
(base) C:\Users\Administrator>D: (base) D:\>cd GaoHongWorkSpace (base) D:\GaoHongWorkSpace>cd anaconda (base) D:\GaoHongWorkSpace\anaconda>jupyter notebook
4.新建ipynb文件
new python3
5.开始编写
from pyecharts import options as opts from pyecharts.charts import Bar c = ( Bar() .add_xaxis( [ "名字很长的X轴标签1", "名字很长的X轴标签2", "名字很长的X轴标签3", "名字很长的X轴标签4", "名字很长的X轴标签5", "名字很长的X轴标签6", "名字很长的X轴标签7", "名字很长的X轴标签8", "名字很长的X轴标签9", "名字很长的X轴标签10", ] ) .add_yaxis("商家A", [10, 20, 30, 40, 50, 40,120,110,52,85], markpoint_opts=opts.MarkPointOpts(data=[opts.MarkPointItem(type_="min",name = "最小值")]),markline_opts=opts.MarkPointOpts(data=[opts.MarkPointItem(type_="average",name = "平均值A")])) .add_yaxis("商家B", [20, 10, 40, 30, 40, 50,65,33,85,48],markpoint_opts=opts.MarkPointOpts(data=[opts.MarkPointItem(type_="max",name = "最大值")]),markline_opts=opts.MarkPointOpts(data=[opts.MarkPointItem(type_="average",name = "平均值B")])) .set_colors(["#0780cf","#009db2"]) .set_global_opts( xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=15)), title_opts=opts.TitleOpts(title="Bar-旋转X轴标签", subtitle="解决标签名字过长的问题"), ) ) c.render_notebook()