本文整理汇总了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()
示例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()
示例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)
)
示例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()
示例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()
示例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")
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()