當前位置: 首頁>>代碼示例>>Python>>正文


Python pyecharts.Line類代碼示例

本文整理匯總了Python中pyecharts.Line的典型用法代碼示例。如果您正苦於以下問題:Python Line類的具體用法?Python Line怎麽用?Python Line使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Line類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_grid_four_direction

def test_grid_four_direction():
    v1 = [5, 20, 36, 10, 75, 90]
    v2 = [10, 25, 8, 60, 20, 80]
    bar = Bar("柱狀圖示例", height=720, width=1200, title_pos="65%")
    bar.add("商家A", CLOTHES, v1, is_stack=True)
    bar.add("商家B", CLOTHES, v2, is_stack=True, legend_pos="80%")
    line = Line("折線圖示例")
    line.add("最高氣溫", WEEK, [11, 11, 15, 13, 12, 13, 10],
             mark_point=["max", "min"], mark_line=["average"])
    line.add("最低氣溫", WEEK, [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%")

    grid = Grid()
    grid.add(bar, grid_bottom="60%", grid_left="60%")
    grid.add(line, grid_bottom="60%", grid_right="60%")
    grid.add(scatter, grid_top="60%", grid_left="60%")
    grid.add(es, grid_top="60%", grid_right="60%")
    grid.render()
開發者ID:chumingke,項目名稱:pyecharts,代碼行數:26,代碼來源:test_grid.py

示例2: test_grid_line_pie

def test_grid_line_pie():
    line = Line("折線圖示例", width=1200)
    line.add(
        "最高氣溫",
        WEEK,
        [11, 11, 15, 13, 12, 13, 10],
        mark_point=["max", "min"],
        mark_line=["average"],
    )
    line.add(
        "最低氣溫",
        WEEK,
        [1, -2, 2, 5, 3, 2, 0],
        mark_point=["max", "min"],
        mark_line=["average"],
        legend_pos="20%",
    )
    v1 = [11, 12, 13, 10, 10, 10]
    pie = Pie("餅圖示例", title_pos="55%")
    pie.add(
        "",
        CLOTHES,
        v1,
        radius=[45, 65],
        center=[65, 50],
        legend_pos="80%",
        legend_orient="vertical",
    )

    grid = Grid()
    grid.add(line, grid_right="55%")
    grid.add(pie, grid_left="60%")
    grid.render()
開發者ID:Jesszen,項目名稱:pyecharts,代碼行數:33,代碼來源:test_grid.py

示例3: test_grid_properties

def test_grid_properties():
    v1 = [5, 20, 36, 10, 75, 90]
    v2 = [10, 25, 8, 60, 20, 80]
    bar = Bar("柱狀圖示例", height=720)
    bar.add("商家A", CLOTHES, v1, is_stack=True)
    bar.add("商家B", CLOTHES, v2, is_stack=True)
    line = Line("折線圖示例", title_top="50%")
    line.add(
        "最高氣溫",
        WEEK,
        [11, 11, 15, 13, 12, 13, 10],
        mark_point=["max", "min"],
        mark_line=["average"],
    )
    line.add(
        "最低氣溫",
        WEEK,
        [1, -2, 2, 5, 3, 2, 0],
        mark_point=["max", "min"],
        mark_line=["average"],
        legend_top="50%",
    )

    grid = Grid(width=1024, height=768)
    grid.add(bar, grid_bottom="60%")
    grid.add(line, grid_top="60%")
    eq_(grid.width, 1024)
    eq_(grid.height, 768)
    assert (
        ("echarts" in bar.js_dependencies)
        or ("echarts.min" in bar.js_dependencies)
    )
開發者ID:Jesszen,項目名稱:pyecharts,代碼行數:32,代碼來源:test_chart_properties.py

示例4: test_grid_top_bottom

def test_grid_top_bottom():
    v1 = [5, 20, 36, 10, 75, 90]
    v2 = [10, 25, 8, 60, 20, 80]
    bar = Bar("柱狀圖示例", height=720)
    bar.add("商家A", CLOTHES, v1, is_stack=True)
    bar.add("商家B", CLOTHES, v2, is_stack=True)
    line = Line("折線圖示例", title_top="50%")
    line.add(
        "最高氣溫",
        WEEK,
        [11, 11, 15, 13, 12, 13, 10],
        mark_point=["max", "min"],
        mark_line=["average"],
    )
    line.add(
        "最低氣溫",
        WEEK,
        [1, -2, 2, 5, 3, 2, 0],
        mark_point=["max", "min"],
        mark_line=["average"],
        legend_top="50%",
    )

    grid = Grid()
    grid.add(bar, grid_bottom="60%")
    grid.add(line, grid_top="60%")
    grid.render()
開發者ID:Jesszen,項目名稱:pyecharts,代碼行數:27,代碼來源:test_grid.py

示例5: test_grid_add_overlap

def test_grid_add_overlap():
    from pyecharts import Overlap

    grid = Grid()

    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]
    v3 = [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]

    bar = Bar("Overlap+Grid 示例", width=1200, height=600, title_pos="40%")
    bar.add("蒸發量", attr, v1)
    bar.add(
        "降水量",
        attr,
        v2,
        yaxis_formatter=" ml",
        yaxis_max=250,
        legend_pos="85%",
        legend_orient="vertical",
        legend_top="45%",
    )

    line = Line()
    line.add("平均溫度", attr, v3, yaxis_formatter=" °C")

    overlap = Overlap()
    overlap.add(bar)
    overlap.add(line, is_add_yaxis=True, yaxis_index=1)

    grid.add(overlap, grid_right="20%")
    grid.render()
開發者ID:Jesszen,項目名稱:pyecharts,代碼行數:32,代碼來源:test_grid.py

示例6: draw_sentiment_pic

def draw_sentiment_pic(csv_file):
    attr, val = [], []
    info = count_sentiment(csv_file)
    info = sorted(info.items(), key=lambda x: x[0], reverse=False)  # dict的排序方法
    for each in info[:-1]:
        attr.append(each[0])
        val.append(each[1])
    line = Line(csv_file+":影評情感分析")
    line.add("", attr, val, is_smooth=True, is_more_utils=True)
    line.render(csv_file+"_情感分析曲線圖.html")
開發者ID:miaomao1989,項目名稱:DA_projects,代碼行數:10,代碼來源:visualization_analysis.py

示例7: test_line_es

def test_line_es():
    v1 = [5, 20, 36, 10, 10, 100]
    line = Line("line-EffectScatter 示例")
    line.add("", CLOTHES, v1, is_random=True)
    es = EffectScatter()
    es.add("", CLOTHES, v1, effect_scale=8)

    overlap = Overlap()
    overlap.add(line)
    overlap.add(es)
    overlap.render()
開發者ID:chumingke,項目名稱:pyecharts,代碼行數:11,代碼來源:test_overlap.py

示例8: test_overlap_bar_line

def test_overlap_bar_line():
    attr = ['A', 'B', 'C', 'D', 'E', 'F']
    v1 = [10, 20, 30, 40, 50, 60]
    v2 = [38, 28, 58, 48, 78, 68]
    bar = Bar("Line-Bar 示例")
    bar.add("bar", attr, v1)
    line = Line()
    line.add("line", attr, v2)

    overlap = Overlap()
    overlap.add(bar)
    overlap.add(line)
    overlap.render()
開發者ID:chumingke,項目名稱:pyecharts,代碼行數:13,代碼來源:test_overlap.py

示例9: test_line_user_define_marks

def test_line_user_define_marks():
    line = Line("折線圖示例")
    line.add("商家A", CLOTHES, clothes_v1,
             mark_point=["average", "max", "min"],
             mark_point_symbol='diamond', mark_point_textcolor='#40ff27')
    line.add("商家B", CLOTHES, clothes_v2,
             mark_point=["average", "max", "min"],
             mark_point_symbol='arrow', mark_point_symbolsize=40)
    line.show_config()
    line.render()
開發者ID:chumingke,項目名稱:pyecharts,代碼行數:10,代碼來源:test_line.py

示例10: test_grid_multiple_datazoom_index

def test_grid_multiple_datazoom_index():
    line = Line("折線圖示例", width=1200, height=700)
    line.add("最高氣溫", WEEK, [11, 11, 15, 13, 12, 13, 10],
             mark_point=["max", "min"], mark_line=["average"])
    line.add("最低氣溫", WEEK, [1, -2, 2, 5, 3, 2, 0],
             mark_point=["max", "min"], legend_top="50%",
             mark_line=["average"], is_datazoom_show=True,
             datazoom_xaxis_index=[0, 1])

    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],
          [2364.54, 2359.51, 2330.86, 2369.65],
          [2332.08, 2273.4, 2259.25, 2333.54],
          [2274.81, 2326.31, 2270.1, 2328.14],
          [2333.61, 2347.18, 2321.6, 2351.44],
          [2340.44, 2324.29, 2304.27, 2352.02],
          [2326.42, 2318.61, 2314.59, 2333.67],
          [2314.68, 2310.59, 2296.58, 2320.96],
          [2309.16, 2286.6, 2264.83, 2333.29],
          [2282.17, 2263.97, 2253.25, 2286.33],
          [2255.77, 2270.28, 2253.31, 2276.22]]
    kline = Kline("K 線圖示例", title_top="50%")
    kline.add("日K", ["2017/7/{}".format(i + 1) for i in range(31)], v1,
              is_datazoom_show=True)

    grid = Grid()
    grid.add(line, grid_top="60%")
    grid.add(kline, grid_bottom="60%")
    grid.render()
開發者ID:chumingke,項目名稱:pyecharts,代碼行數:48,代碼來源:test_grid.py

示例11: test_overlap_two_yaxis

def test_overlap_two_yaxis():
    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]
    v3 = [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]

    bar = Bar(width=1200, height=600)
    bar.add("蒸發量", attr, v1)
    bar.add("降水量", attr, v2, yaxis_formatter=" ml", yaxis_max=250)

    line = Line()
    line.add("平均溫度", attr, v3, yaxis_formatter=" °C")

    overlap = Overlap()
    overlap.add(bar)
    overlap.add(line, yaxis_index=1, is_add_yaxis=True)
    overlap.render()
開發者ID:chumingke,項目名稱:pyecharts,代碼行數:17,代碼來源:test_overlap.py

示例12: test_line_negative_value

def test_line_negative_value():
    line = Line("折線圖示例")
    line.add("最高氣溫", WEEK, [11, 11, 15, 13, 12, 13, 10],
             mark_point=["max", "min"], mark_line=["average"])
    line.add("最低氣溫", WEEK, [1, -2, 2, 5, 3, 2, 0],
             mark_point=["max", "min"], mark_line=["average"])
    line.render()
開發者ID:chumingke,項目名稱:pyecharts,代碼行數:7,代碼來源:test_line.py

示例13: iplot

def iplot(indicator, new=True, axes=None, 
          legend_on=False, text_on=False, text_color='k',  
          zero_on=False, label=None, *args, **kwargs):
    """繪製indicator曲線
    
    :param Indicator indicator: indicator實例
    :param axes:            指定的坐標軸
    :param new:             pyecharts中無效
    :param legend_on:       是否打開圖例
    :param text_on:         是否在左上角顯示指標名稱及其參數
    :param text_color:      指標名稱解釋文字的顏色,默認為黑色
    :param zero_on:         是否需要在y=0軸上繪製一條直線
    :param str label:       label顯示文字信息,text_on 及 legend_on 為 True 時生效
    :param args:            pylab plot參數
    :param kwargs:          pylab plot參數,如:marker(標記類型)、
                             markerfacecolor(標記顏色)、
                             markeredgecolor(標記的邊緣顏色)
    """
    if not indicator:
        print("indicator is None")
        return
    
    if axes is None:
        axes = create_figure() if new else gca()
    
    if not label:
        label = "%s %.2f" % (indicator.long_name, indicator[-1])

    x_list = gcf().get_xaxis()
    if x_list is None:
        x_list = [i for i in range(len(indicator))]
        
    y_list = [ '-' if x == constant.null_price else round(x,3) for x in indicator]
    line = Line()
    
    style = gcf().get_style(axes, **kwargs)
    line.add(label, x_list, y_list, 
             yaxis_min=min(indicator),
             is_legend_show=legend_on,
             *args, **style)
    
    axes.add(line)
    
    gcf().add_axis(axes)
    return gcf()
開發者ID:fasiondog,項目名稱:hikyuu,代碼行數:45,代碼來源:echart_draw.py

示例14: test_line_user_define_markpoint

def test_line_user_define_markpoint():
    line = Line("折線圖示例")
    line.add("商家A", CLOTHES, clothes_v1,
             mark_point=["average", {
                 "coord": ["褲子", 10], "name": "這是我想要的第一個標記點"}])
    line.add("商家B", CLOTHES, clothes_v2, is_smooth=True,
             mark_point=[{
                 "coord": ["襪子", 80], "name": "這是我想要的第二個標記點"}])
    line.render()
開發者ID:chumingke,項目名稱:pyecharts,代碼行數:9,代碼來源:test_line.py

示例15: test_line_log_yaxis

def test_line_log_yaxis():
    import math
    import random
    line = Line("折線圖示例")
    line.add("商家A", CLOTHES,
             [math.log10(random.randint(1, 99999)) for _ in range(6)])
    line.add("商家B", CLOTHES,
             [math.log10(random.randint(1, 99999999)) for _ in range(6)],
             yaxis_type="log")
    line.render()
開發者ID:chumingke,項目名稱:pyecharts,代碼行數:10,代碼來源:test_line.py


注:本文中的pyecharts.Line類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。