def pic_bar_microchip(values, label): pictorialbar = PictorialBar( init_opts=opts.InitOpts(width='480px', height='700px')) pictorialbar.add_xaxis(label) pictorialbar.add_yaxis("", values[0], symbol_size=18, symbol_repeat='20', symbol_offset=[0, 0], is_symbol_clip=True, symbol='rect', color='#F95DBA', gap='-100%', symbol_margin=10, label_opts=opts.LabelOpts(is_show=False)) pictorialbar.add_yaxis("高通骁龙", values[1], symbol_size=18, label_opts=opts.LabelOpts(is_show=False), symbol_repeat='20', symbol_offset=[0, 0], is_symbol_clip=True, symbol='rect', color='#FFCE2B', gap='-100%', symbol_margin=10) pictorialbar.add_yaxis("联发科天玑/MT", values[2], label_opts=opts.LabelOpts(is_show=False), symbol_size=18, symbol_repeat='20', symbol_offset=[0, 0], is_symbol_clip=True, symbol='rect', color='#009688', gap='-100%', symbol_margin=10) pictorialbar.add_yaxis("华为麒麟", values[3], yaxis_index=0, label_opts=opts.LabelOpts(is_show=False), symbol_size=18, symbol_repeat='20', symbol_offset=[0, 0], is_symbol_clip=True, symbol='rect', color='#1720D1', gap='-100%', symbol_margin=10) pictorialbar.add_yaxis("三星Exynos", values[4], yaxis_index=0, label_opts=opts.LabelOpts(is_show=False), symbol_size=18, symbol_repeat='20', symbol_offset=[0, 0], is_symbol_clip=True, symbol='rect', color='white', gap='-100%', symbol_margin=10) pictorialbar.set_global_opts( xaxis_opts=opts.AxisOpts(is_show=False), yaxis_opts=opts.AxisOpts( is_show=True, axistick_opts=opts.AxisTickOpts(is_show=False)), legend_opts=opts.LegendOpts(pos_bottom='9%', pos_right='10%', orient='vertical', item_width=18, item_height=18), title_opts=opts.TitleOpts(title='各品牌5G手机芯片比较', pos_left='center', pos_top='2%')) pictorialbar.reversal_axis() pictorialbar.render('各品牌5G手机芯片比较.html')
def pic_bar_price(values, label): """ 5G手机价位比较 """ # 初始化,设置图表大小 pictorialbar = PictorialBar( init_opts=opts.InitOpts(width='480px', height='700px')) # x轴标签信息 pictorialbar.add_xaxis(label) # 添加象形图 pictorialbar.add_yaxis("", values[0], symbol_size=18, symbol_repeat='20', symbol_offset=[0, 0], is_symbol_clip=True, symbol='rect', color='#FCA46A', gap='-100%', symbol_margin=10, label_opts=opts.LabelOpts(is_show=False)) pictorialbar.add_yaxis("5000元及以上", values[1], symbol_size=18, label_opts=opts.LabelOpts(is_show=False), symbol_repeat='20', symbol_offset=[0, 0], is_symbol_clip=True, symbol='rect', color='#F95DBA', gap='-100%', symbol_margin=10) pictorialbar.add_yaxis("3000-4999元", values[2], label_opts=opts.LabelOpts(is_show=False), symbol_size=18, symbol_repeat='20', symbol_offset=[0, 0], is_symbol_clip=True, symbol='rect', color='#4E70F0', gap='-100%', symbol_margin=10) pictorialbar.add_yaxis("1000-2999元", values[3], yaxis_index=0, label_opts=opts.LabelOpts(is_show=False), symbol_size=18, symbol_repeat='20', symbol_offset=[0, 0], is_symbol_clip=True, symbol='rect', color='#1720D1', gap='-100%', symbol_margin=10) pictorialbar.add_yaxis("999元及以下", values[4], yaxis_index=0, label_opts=opts.LabelOpts(is_show=False), symbol_size=18, symbol_repeat='20', symbol_offset=[0, 0], is_symbol_clip=True, symbol='rect', color='white', gap='-100%', symbol_margin=10) pictorialbar.set_global_opts( # 隐藏x坐标轴 xaxis_opts=opts.AxisOpts(is_show=False), # 显示y坐标轴,隐藏刻度线 yaxis_opts=opts.AxisOpts( is_show=True, axistick_opts=opts.AxisTickOpts(is_show=False)), # 显示图例,设置图例位置 legend_opts=opts.LegendOpts(pos_bottom='9%', pos_right='10%', orient='vertical', item_width=18, item_height=18), # 添加标题,设置标题位置 title_opts=opts.TitleOpts(title='各品牌5G手机价位比较', pos_left='center', pos_top='2%')) pictorialbar.reversal_axis() pictorialbar.render('各品牌5G手机价位比较.html')
"temperature", tem_data, label_opts=opts.LabelOpts(is_show=False), symbol_size=18, symbol_repeat="fixed", symbol_offset=[0, 0], is_symbol_clip=True, symbol=SymbolType.ARROW ) # pictorialbar.reversal_axis() pictorialbar.set_global_opts( title_opts=opts.TitleOpts(title="中秋节省会城市降雨和温度情况"), xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=-30), is_show=True), yaxis_opts=opts.AxisOpts( axistick_opts=opts.AxisTickOpts(is_show=False), axisline_opts=opts.AxisLineOpts( linestyle_opts=opts.LineStyleOpts(opacity=0) ), axislabel_opts=opts.LabelOpts(formatter="{value}% 降水概率") ), datazoom_opts=opts.DataZoomOpts() ) # 添加折线 # line = Line() # line.add_xaxis(zhongqiu_city) # line.add_yaxis("", tem_data) # line.add_yaxis("", weather_data) # pictorialbar.overlap(line) pictorialbar.render_notebook() # 在双轴图中查看