柱状图
bar 基本演示例子
from pyecharts import options as opts from pyecharts.charts import Bar c =( Bar().add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]) .add_yaxis('商家A', [114, 55, 27, 101, 125, 27, 105]) .add_yaxis('商家B',[57, 134, 137, 129, 145, 60, 49]) .set_global_opts(title_opts=opts.TitleOpts(title='Bar-基本展示',subtitle='我是副标题')) ) c.render_notebook()
默认取消某series
默认不显示B的商品
from pyecharts import options as opts from pyecharts.charts import Bar c =( Bar().add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]) .add_yaxis('商家A', [114, 55, 27, 101, 125, 27, 105]) .add_yaxis('商家B',[57, 134, 137, 129, 145, 60, 49],is_selected=False) .set_global_opts(title_opts=opts.TitleOpts(title='Bar-基本展示',subtitle='我是副标题')) ) c.render_notebook()
显示工具箱
from pyecharts.charts import Bar c =( Bar().add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]). add_yaxis('商家A', [114, 55, 27, 101, 125, 27, 105]) .add_yaxis('商家B',[57, 134, 137, 129, 145, 60, 49]) .set_global_opts( title_opts=opts.TitleOpts(title="Bar-显示 ToolBox"), toolbox_opts=opts.ToolboxOpts(), legend_opts=opts.LegendOpts(is_show=False) ) ) c.render_notebook()
bar Y轴formatter (y轴带坐标的)
from pyecharts.charts import Bar c =( Bar().add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]). add_yaxis('商家A', [114, 55, 27, 101, 125, 27, 105]) .add_yaxis('商家B',[57, 134, 137, 129, 145, 60, 49]) .set_global_opts( title_opts=opts.TitleOpts(title="Bar-Y 轴 formatter"), yaxis_opts=opts.AxisOpts( axislabel_opts=opts.LabelOpts(formatter="{value} /月") ), ) ) c.render_notebook()
Bar 指定类型 最大值,最小值,平均值显示
from pyecharts.charts import Bar c =( Bar().add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]). add_yaxis('商家A', [114, 55, 27, 101, 125, 27, 105]) .add_yaxis('商家B',[57, 134, 137, 129, 145, 60, 49]) .set_global_opts(title_opts=opts.TitleOpts(title="Bar-MarkPoint(指定类型)"), yaxis_opts=opts.AxisOpts( axislabel_opts=opts.LabelOpts(formatter="{value} /月") ),) .set_series_opts( label_opts=opts.LabelOpts(is_show=False), markpoint_opts=opts.MarkPointOpts( data=[ opts.MarkPointItem(type_="max", name="最大值"), opts.MarkPointItem(type_="min", name="最小值"), opts.MarkPointItem(type_="average", name="平均值"), ] ), ) ) c.render_notebook()
bar -markline 指定类型(划横线那种)
from pyecharts.charts import Bar c =( Bar().add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]). add_yaxis('商家A', [114, 55, 27, 101, 125, 27, 105]) .add_yaxis('商家B',[57, 134, 137, 129, 145, 60, 49]) .set_global_opts(title_opts=opts.TitleOpts(title='Bar-MARKline显示数据')) .set_series_opts( label_opts=opts.LabelOpts(is_show=False), markline_opts=opts.MarkLineOpts( data=[ opts.MarkLineItem(type_="min", name="最小值"), opts.MarkLineItem(type_="max", name="最大值"), opts.MarkLineItem(type_="average", name="平均值"), ] ), ) ) c.render_notebook()
Bar 可以滑动的直方图 控制
from pyecharts.charts import Bar c =( Bar().add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]). add_yaxis('商家A', [114, 55, 27, 101, 125, 27, 105]) .add_yaxis('商家B',[57, 134, 137, 129, 145, 60, 49]) .set_global_opts( title_opts=opts.TitleOpts(title="Bar-DataZoom(slider-垂直)"), datazoom_opts=opts.DataZoomOpts(orient="vertical"), ) ) c.render_notebook()
年与时驰,意与日去,遂成枯落,
多不接世,悲守穷庐,将复何及。