当前位置: 首页>>代码示例>>Python>>正文


Python Bar.render方法代码示例

本文整理汇总了Python中pyecharts.Bar.render方法的典型用法代码示例。如果您正苦于以下问题:Python Bar.render方法的具体用法?Python Bar.render怎么用?Python Bar.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyecharts.Bar的用法示例。


在下文中一共展示了Bar.render方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_custom_template_for_chart

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
def test_custom_template_for_chart():
    data = [{
        'name': '衬衫',
        'value': 5
    }, {
        'name': '羊毛衫',
        'value': 20
    }, {
        'name': '雪纺衫',
        'value': 36
    }]

    configure(echarts_template_dir='.')

    online()

    data1 = {'衬衫': '34', '羊毛衫': 45, '雪纺衫': 40}
    names, values = Bar.cast(data)
    names1, values1 = Bar.cast(data1)
    bar = Bar("柱状图数据堆叠示例")
    bar.add("商家A", names, values, is_stack=True)
    bar.add("商家B", names1, values1, is_stack=True)
    bar.render(path='new_version_bar.html')
    with codecs.open('new_version_bar.html', 'r', 'utf-8') as f:
        actual_content = f.read()
        assert "</html>" in actual_content
开发者ID:chumingke,项目名称:pyecharts,代码行数:28,代码来源:test_custom_render.py

示例2: test_bar_waterfall

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
def test_bar_waterfall():
    months = ["{}月".format(i) for i in range(1, 8)]
    months_v1 = [0, 100, 200, 300, 400, 220, 250]
    months_v2 = [1000, 800, 600, 500, 450, 400, 300]
    bar = Bar("瀑布图示例")
    bar.add("", months, months_v1, label_color=['rgba(0,0,0,0)'],
            is_stack=True)
    bar.add("月份", months, months_v2, is_label_show=True, is_stack=True,
            label_pos='inside')
    bar.show_config()
    bar.render()
开发者ID:chumingke,项目名称:pyecharts,代码行数:13,代码来源:test_bar.py

示例3: draw_data_echart

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
def draw_data_echart(select_results):
    list_name = []
    list_count = []
    for select_list in select_results:
        list_name.append(select_list[0])
        list_count.append(int(select_list[2]))
        #print ("select name: %s, select count: %d" % (select_list[0], int(select_list[2])))
    bar = Bar("read weekly", "download count")
    bar.use_theme('light')
    bar.add("book download count", list_name, list_count, is_more_utils = True, is_label_show = True, is_datazoom_show = True)
    bar.render("downloadcount.html")
开发者ID:Learntainment,项目名称:Build_learning,代码行数:13,代码来源:crawl_web.py

示例4: generic_formatter_t_est

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
def generic_formatter_t_est(**keywords):
    attr = ["Jan", "Feb"]
    v1 = [2.0, 4.9]
    bar = Bar("Bar chart", "precipitation and evaporation one year")
    bar.add(
        "precipitation",
        attr,
        v1,
        mark_line=["average"],
        mark_point=["max", "min"],
        **keywords
    )
    bar.render()
开发者ID:Jesszen,项目名称:pyecharts,代码行数:15,代码来源:test_translator.py

示例5: test_custom_template_for_chart

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
def test_custom_template_for_chart():
    data = [
        {"name": "衬衫", "value": 5},
        {"name": "羊毛衫", "value": 20},
        {"name": "雪纺衫", "value": 36},
    ]

    configure(echarts_template_dir=".")

    data1 = {"衬衫": "34", "羊毛衫": 45, "雪纺衫": 40}
    names, values = Bar.cast(data)
    names1, values1 = Bar.cast(data1)
    bar = Bar("柱状图数据堆叠示例")
    bar.add("商家A", names, values, is_stack=True)
    bar.add("商家B", names1, values1, is_stack=True)
    bar.render(path="new_version_bar.html")
    with codecs.open("new_version_bar.html", "r", "utf-8") as f:
        actual_content = f.read()
        assert "</html>" in actual_content
开发者ID:Jesszen,项目名称:pyecharts,代码行数:21,代码来源:test_custom_render.py

示例6: test_bar_histogram

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
def test_bar_histogram():
    bar = Bar("直方图示例")
    bar.add("", CLOTHES * 2, clothes_v1 + clothes_v2, bar_category_gap=0)
    bar.render()
开发者ID:chumingke,项目名称:pyecharts,代码行数:6,代码来源:test_bar.py

示例7: Bar

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
#柱形图适合表现几组数据之间的对比关系,柱形图表现的数据的数量一般不宜太多,多了的话会像一堆杂草。

from  pyecharts import Bar

x = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋"]
y1 = [5, 20, 36, 10, 75]
y2 = [10, 25, 8, 60, 20]

bar = Bar(title = "产品月销量",width = 600,height = 420)
bar.add(name = "商家A", x_axis = x, y_axis = y1)
bar.add(name = "商家B", x_axis = x, y_axis = y2,is_xaxis_boundarygap =True)

# 导出绘图html文件,可直接用浏览器打开
bar.render('result.柱形图示范.html')
bar
开发者ID:gitxw,项目名称:PythonStudy,代码行数:17,代码来源:柱形图.py

示例8: test_grid

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
def test_grid():

    # grid_0
    attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
    v1 = [5, 20, 36, 10, 75, 90]
    v2 = [10, 25, 8, 60, 20, 80]
    bar = Bar("柱状图示例", height=720, is_grid=True)
    bar.add("商家A", attr, v1, is_stack=True, grid_bottom="60%")
    bar.add("商家B", attr, v2, is_stack=True, grid_bottom="60%")
    line = Line("折线图示例", title_top="50%")
    attr = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
    line.add("最高气温", attr, [11, 11, 15, 13, 12, 13, 10], mark_point=["max", "min"], mark_line=["average"])
    line.add("最低气温", attr, [1, -2, 2, 5, 3, 2, 0], mark_point=["max", "min"],
             mark_line=["average"], legend_top="50%")
    bar.grid(line.get_series(), grid_top="60%")
    bar.show_config()
    bar.render()

    # grid_1
    v1 = [5, 20, 36, 10, 75, 90]
    v2 = [10, 25, 8, 60, 20, 80]
    scatter = Scatter(width=1200, is_grid=True)
    scatter.add("散点图示例", v1, v2, grid_left="60%", legend_pos="70%")
    es = EffectScatter()
    es.add("动态散点图示例", [11, 11, 15, 13, 12, 13, 10], [1, -2, 2, 5, 3, 2, 0],
           effect_scale=6, legend_pos="20%")
    scatter.grid(es.get_series(), grid_right="60%")
    scatter.show_config()
    scatter.render()

    # grid_2
    attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
    v1 = [5, 20, 36, 10, 75, 90]
    v2 = [10, 25, 8, 60, 20, 80]
    bar = Bar("柱状图示例", height=720, width=1200, title_pos="65%", is_grid=True)
    bar.add("商家A", attr, v1, is_stack=True, grid_bottom="60%", grid_left="60%")
    bar.add("商家B", attr, v2, is_stack=True, grid_bottom="60%", grid_left="60%", legend_pos="80%")
    line = Line("折线图示例")
    attr = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
    line.add("最高气温", attr, [11, 11, 15, 13, 12, 13, 10], mark_point=["max", "min"], mark_line=["average"])
    line.add("最低气温", attr, [1, -2, 2, 5, 3, 2, 0], mark_point=["max", "min"],
             mark_line=["average"], legend_pos="20%")
    v1 = [5, 20, 36, 10, 75, 90]
    v2 = [10, 25, 8, 60, 20, 80]
    scatter = Scatter("散点图示例", title_top="50%", title_pos="65%")
    scatter.add("scatter", v1, v2, legend_top="50%", legend_pos="80%")
    es = EffectScatter("动态散点图示例", title_top="50%")
    es.add("es", [11, 11, 15, 13, 12, 13, 10], [1, -2, 2, 5, 3, 2, 0], effect_scale=6,
           legend_top="50%", legend_pos="20%")
    bar.grid(line.get_series(), grid_bottom="60%", grid_right="60%")
    bar.grid(scatter.get_series(), grid_top="60%", grid_left="60%")
    bar.grid(es.get_series(), grid_top="60%", grid_right="60%")
    bar.show_config()
    bar.render()

    # grid_3
    line = Line("折线图示例", width=1200, is_grid=True)
    attr = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
    line.add("最高气温", attr, [11, 11, 15, 13, 12, 13, 10], mark_point=["max", "min"],
             mark_line=["average"], grid_right="65%")
    line.add("最低气温", attr, [1, -2, 2, 5, 3, 2, 0], mark_point=["max", "min"],
             mark_line=["average"], legend_pos="20%")
    attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
    v1 = [11, 12, 13, 10, 10, 10]
    pie = Pie("饼图示例", title_pos="45%")
    pie.add("", attr, v1, radius=[30, 55], legend_pos="65%", legend_orient='vertical')
    line.grid(pie.get_series(), grid_left="60%")
    line.show_config()
    line.render()

    # grid_4
    line = Line("折线图示例", width=1200, is_grid=True)
    attr = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
    line.add("最高气温", attr, [11, 11, 15, 13, 12, 13, 10], mark_point=["max", "min"],
             mark_line=["average"], grid_right="60%")
    line.add("最低气温", attr, [1, -2, 2, 5, 3, 2, 0], mark_point=["max", "min"],
             mark_line=["average"], legend_pos="20%", grid_right="60%")
    attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
    value = [20, 40, 60, 80, 100, 120]
    v1 = [[2320.26, 2320.26, 2287.3, 2362.94],
          [2300, 2291.3, 2288.26, 2308.38],
          [2295.35, 2346.5, 2295.35, 2345.92],
          [2347.22, 2358.98, 2337.35, 2363.8],
          [2360.75, 2382.48, 2347.89, 2383.76],
          [2383.43, 2385.42, 2371.23, 2391.82],
          [2377.41, 2419.02, 2369.57, 2421.15],
          [2425.92, 2428.15, 2417.58, 2440.38],
          [2411, 2433.13, 2403.3, 2437.42],
          [2432.68, 2334.48, 2427.7, 2441.73],
          [2430.69, 2418.53, 2394.22, 2433.89],
          [2416.62, 2432.4, 2414.4, 2443.03],
          [2441.91, 2421.56, 2418.43, 2444.8],
          [2420.26, 2382.91, 2373.53, 2427.07],
          [2383.49, 2397.18, 2370.61, 2397.94],
          [2378.82, 2325.95, 2309.17, 2378.82],
          [2322.94, 2314.16, 2308.76, 2330.88],
          [2320.62, 2325.82, 2315.01, 2338.78],
          [2313.74, 2293.34, 2289.89, 2340.71],
          [2297.77, 2313.22, 2292.03, 2324.63],
          [2322.32, 2365.59, 2308.92, 2366.16],
#.........这里部分代码省略.........
开发者ID:ljwdoc,项目名称:pyecharts,代码行数:103,代码来源:test_grid.py

示例9: draw_result

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
    def draw_result(self):
        mongo_region_dist = mongo_db['regiondist']
        regiondist = mongo_region_dist.find({}, {"_id": 0})
        attr = []
        value = []
        for item in regiondist:
            value.append(item['totalCount'])
            attr.append(item["region"])
        map = Map("淘宝淘女郎全国分布图", width=1200, height=600)
        map.add("", attr, value, maptype='china', visual_range=[0, 5000], is_visualmap=True,
                         visual_text_color='#000')
        map.render(r"charts/regionDistribute.html")

        #某些城市的地理坐标无法正确获取,故绘图结果不不正确,待完善
        '''mongo_city_dist = mongo_db['citydist']
        citydist = mongo_city_dist.find({}, {"_id": 0})
        attr = []
        value = []
        for item in citydist:
            value.append(item['totalCount'])
            attr.append(item["city"])
        geo = Geo("淘宝淘女郎城市分布图", "data from mm.taobao.com", title_color="#fff", title_pos="center",
                  width=1200, height=600, background_color='#404a59')
        geo.add("", attr, value, visual_range=[0, 1000], visual_text_color="#fff", symbol_size=12, is_visualmap=True)
        geo.render(r"charts/cityDistribute.html")'''

        mongo_height_stat = mongo_db['heightstat']
        heightstat = mongo_height_stat.find({}, {"_id": 0})
        attr = []
        value = []
        for item in heightstat:
            value.append(item['value'])
            attr.append(item["height"])
        bar = Bar("淘宝淘女郎身高分布图", "data from mm.taobao.com")
        bar.add("", attr,value)
        bar.render("charts/heightstat.html")

        mongo_weight_stat = mongo_db['weightstat']
        weightstat = mongo_weight_stat.find({}, {"_id": 0})
        attr = []
        value = []
        for item in weightstat:
            value.append(item['value'])
            attr.append(item["weight"])
        bar = Bar("淘宝淘女郎体重分布图", "data from mm.taobao.com")
        bar.add("", attr, value)
        bar.render("charts/weightstat.html")

        mongo_blood_stat = mongo_db['bloodstat']
        bloodstat = mongo_blood_stat.find({}, {"_id": 0})
        attr = []
        value = []
        for item in bloodstat:
            value.append(item['value'])
            attr.append(item["blood"])
        bar = Bar("淘宝淘女郎血型分布图", "data from mm.taobao.com")
        bar.add("", attr, value)
        bar.render("charts/bloodstat.html")

        mongo_birthday_stat = mongo_db['birthdaystat']
        birthdaystat = mongo_birthday_stat.find({}, {"_id": 0})
        attr = []
        value = []
        for item in birthdaystat:
            value.append(item['value'])
            attr.append(item["blood"])
        bar = Bar("淘宝淘女郎生日星座分布图", "data from mm.taobao.com")
        bar.add("", attr, value)
        bar.render("charts/birthdaystat.html")
开发者ID:zhmhhu,项目名称:taobaoSpider,代码行数:71,代码来源:statistic.py

示例10: configure

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
# coding=utf8

from __future__ import unicode_literals

from pyecharts import configure, Bar

configure(echarts_template_dir='my_tpl')

attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
v1 = [5, 20, 36, 10, 75, 90]
v2 = [10, 25, 8, 60, 20, 80]
bar = Bar("柱状图数据堆叠示例", jshost='	https://cdn.bootcss.com/echarts/3.6.2')
bar.add("商家A", attr, v1, is_stack=True)
bar.add("商家B", attr, v2, is_stack=True)
bar.render(path='my_bar_demo.html', template_name='tpl_demo.html', object_name='bar')
开发者ID:Mocha-Pudding,项目名称:pyecharts-users-cases,代码行数:17,代码来源:custom_tpl_demo.py

示例11: test_bar

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
def test_bar():

    # bar_0
    attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
    v1 = [5, 20, 36, 10, 75, 90]
    v2 = [10, 25, 8, 60, 20, 80]
    bar = Bar("柱状图数据堆叠示例")
    bar.add("商家A", attr, v1, is_stack=True)
    bar.add("商家B", attr, v2, is_stack=True)
    bar.render()

    # bar_1
    bar = Bar("标记线和标记点示例")
    bar.add("商家A", attr, v1, mark_point=["average"])
    bar.add("商家B", attr, v2, mark_line=["min", "max"])
    bar.render()

    # bar_2
    bar = Bar("x 轴和 y 轴交换")
    bar.add("商家A", attr, v1)
    bar.add("商家B", attr, v2, is_convert=True)
    bar.render()

    # bar_3
    attr = ["{}月".format(i) for i in range(1, 13)]
    v1 = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
    v2 = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
    bar = Bar("柱状图示例")
    bar.add("蒸发量", attr, v1, mark_line=["average"], mark_point=["max", "min"])
    bar.add("降水量", attr, v2, mark_line=["average"], mark_point=["max", "min"],
            is_datazoom_show=True, datazoom_range=[20, 60], datazoom_type='inside')
    bar.show_config()
    bar.render()

    # bar_3_1
    bar = Bar("柱状图示例")
    bar.add("蒸发量", attr, v1, mark_line=["average"], mark_point=["max", "min"])
    bar.add("降水量", attr, v2, mark_line=["average"], mark_point=["max", "min"],
            is_datazoom_show=True, datazoom_range=[50, 80])
    bar.show_config()
    bar.render()

    # bar_4
    import random

    attr = ["{}天".format(i) for i in range(30)]
    v1 = [random.randint(1, 30) for _ in range(30)]
    bar = Bar("Bar - datazoom - slider 示例")
    bar.add("", attr, v1, is_label_show=True, is_datazoom_show=True)
    bar.show_config()
    bar.render()

    # bar_5
    attr = ["{}天".format(i) for i in range(30)]
    v1 = [random.randint(1, 30) for _ in range(30)]
    bar = Bar("Bar - datazoom - inside 示例")
    bar.add("", attr, v1, is_datazoom_show=True, datazoom_type='inside', datazoom_range=[10, 25])
    bar.show_config()
    bar.render()
开发者ID:ljwdoc,项目名称:pyecharts,代码行数:61,代码来源:test_bar.py

示例12: print

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
chabj=[x for x in bingji if x not in attr]

chaqh = [x for x in bingji if x not in attr2]

attr_yes =set(chabj+chaqh+bingji)
attrok=sorted(attr_yes)
print(attrok)

for i in chabj:
    countbj.setdefault(i,0)
bjv=sorted(countbj.items(),key=lambda x:x[0])
print(bjv)

v1=[x[1] for x in bjv]
print(v1)


for i in chaqh:
    countqh.setdefault(i,0)
qhv=sorted(countqh.items(),key=lambda x:x[0])
print(qhv)

v2=[x[1] for x in qhv]
print(v2)


bar = Bar  ("清华北大(上海)自主选拔录取人数",height=650,width=1200)
bar.add("北京大学",attrok,v1,is_stack=True,xaxis_interval=0, xaxis_rotate=0, yaxis_rotate=0,xaxis_margin=2,is_xaxislabel_align=True,is_xaxis_boundarygap=True,xaxis_label_textsize=9,is_convert=True)
bar.add("清华大学",attrok,v2,is_stack=True,xaxis_interval=0, xaxis_rotate=0, yaxis_rotate=0,xaxis_margin=2,is_xaxislabel_align=True,is_xaxis_boundarygap=True,xaxis_label_textsize=9,is_convert=True)
bar.render()
开发者ID:qfsf0220,项目名称:gitskills,代码行数:32,代码来源:test6.py

示例13: Bar

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : Fri Feb  8 22:31:03 2019
# @Author : JRP - Ruipeng Jia
from pyecharts import Bar  # need to install echarts-cities-pypkg

attr = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
v1 = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
v2 = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
bar = Bar("Bar chart", "precipitation and evaporation one year")
bar.add("precipitation", attr, v1, mark_line=["average"], mark_point=["max", "min"])
bar.add("evaporation", attr, v2, mark_line=["average"], mark_point=["max", "min"])
bar.render(path='tmp.html')
bar.render(path='tmp.png')  # also can be png, need to install pyecharts-snapshot
开发者ID:coder352,项目名称:shellscript,代码行数:16,代码来源:l1_bar.py

示例14:

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render [as 别名]
# !/usr/bin/env python
开发者ID:ShaoJianbo,项目名称:PythonProjects,代码行数:3,代码来源:bilibili_data_statistics.py


注:本文中的pyecharts.Bar.render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。