Example #1
0
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')
Example #2
0
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')
Example #3
0

# 获取降水和温度信息
weather_data = map(check_weather, zhongqiu['wea'].values.tolist())
weather_data = list(weather_data)
tem_data = map(trans_tem, zhongqiu['tem'].values.tolist())
tem_data = list(tem_data)

# 降水和温度柱状图
pictorialbar = PictorialBar()
pictorialbar.add_xaxis(zhongqiu_city)
pictorialbar.add_yaxis(
    "weather", weather_data,
    label_opts=opts.LabelOpts(is_show=False),
    symbol_size=18,
    symbol_repeat="fixed",
    symbol_offset=[0, 0],
    is_symbol_clip=True,
    symbol=SymbolType.ROUND_RECT
)
pictorialbar.add_yaxis(
    "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()