本文整理汇总了Python中pyecharts.Line.add方法的典型用法代码示例。如果您正苦于以下问题:Python Line.add方法的具体用法?Python Line.add怎么用?Python Line.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyecharts.Line
的用法示例。
在下文中一共展示了Line.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_line_negative_value
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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()
示例2: test_grid_add_overlap
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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()
示例3: test_grid_inverse_yaxis
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
def test_grid_inverse_yaxis():
attr = ["{}天".format(i) for i in range(1, 31)]
line_top = Line("折线图示例", width=1200, height=700)
line_top.add(
"最高气温",
attr,
[random.randint(20, 100) for i in range(30)],
mark_point=["max", "min"],
mark_line=["average"],
legend_pos="38%",
)
line_bottom = Line()
line_bottom.add(
"最低气温",
attr,
[random.randint(20, 100) for i in range(30)],
mark_point=["max", "min"],
mark_line=["average"],
is_yaxis_inverse=True,
xaxis_pos="top",
)
grid = Grid()
grid.add(line_top, grid_bottom="60%")
grid.add(line_bottom, grid_top="50%")
grid.render()
示例4: test_grid_line_pie
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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()
示例5: test_grid_four_direction
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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()
示例6: test_timeline_label_color
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
def test_timeline_label_color():
attr = ["{}月".format(i) for i in range(1, 7)]
bar = Bar("1 月份数据", "数据纯属虚构")
bar.add(
"bar",
attr,
[randint(10, 50) for _ in range(6)],
label_color=["red", "#213", "black"],
)
line = Line()
line.add("line", attr, [randint(50, 80) for _ in range(6)])
overlap_0 = Overlap()
overlap_0.add(bar)
overlap_0.add(line)
bar_1 = Bar("2 月份数据", "数据纯属虚构")
bar_1.add("bar", attr, [randint(10, 50) for _ in range(6)])
line_1 = Line()
line_1.add("line", attr, [randint(50, 80) for _ in range(6)])
overlap_1 = Overlap()
overlap_1.add(bar_1)
overlap_1.add(line_1)
timeline = Timeline(timeline_bottom=0)
timeline.add(overlap_0, "1 月")
timeline.add(overlap_1, "2 月")
content = timeline._repr_html_()
assert '"color": [' in content
assert "red" in content
assert "#213" in content
assert "black" in content
示例7: test_line_type_fil
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
def test_line_type_fil():
line = Line("折线图-面积图示例")
line.add("商家A", CLOTHES, clothes_v1, is_fill=True, line_opacity=0.2,
area_opacity=0.4, symbol=None)
line.add("商家B", CLOTHES, clothes_v2, is_fill=True, area_color='#000',
area_opacity=0.3, is_smooth=True)
assert '"step": true' not in line._repr_html_()
示例8: test_grid_properties
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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)
)
示例9: test_grid_top_bottom
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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()
示例10: test_line_user_define_markpoint
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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()
示例11: draw_sentiment_pic
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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")
示例12: test_line_user_define_marks
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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()
示例13: test_line_log_yaxis
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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()
示例14: test_line_es
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
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()
示例15: test_line_marks
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import add [as 别名]
def test_line_marks():
line = Line("折线图示例")
line.add("商家A", CLOTHES, clothes_v1, mark_point=["average"])
line.add(
"商家B",
CLOTHES,
clothes_v2,
is_smooth=True,
mark_line=["max", "average"],
)
line.render()