本文整理汇总了Python中pyecharts.Line.render方法的典型用法代码示例。如果您正苦于以下问题:Python Line.render方法的具体用法?Python Line.render怎么用?Python Line.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyecharts.Line
的用法示例。
在下文中一共展示了Line.render方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_line_negative_value
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import render [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_line_user_define_markpoint
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import render [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()
示例3: test_line_log_yaxis
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import render [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()
示例4: test_line_user_define_marks
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import render [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()
示例5: draw_sentiment_pic
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import render [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")
示例6: test_line_marks
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import render [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()
示例7: load_js
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import render [as 别名]
import sys
import glob
import os
from pyecharts import Line
def load_js(jsfile):
x_axis = []
points = []
with open(jsfile, 'r') as fp:
while True:
l = fp.readline()
if not l:
break
deal_dict = json.loads(l)
x_axis.append(deal_dict['dealDate'][0])
points.append(deal_dict['unitPrice'][0])
return x_axis, points
if __name__ == '__main__':
dir_path = sys.argv[1]
curve_name = ''
line = Line("Deal Curve")
cwd = os.getcwd()
os.chdir(dir_path)
for js in glob.glob("*.json"):
x_axis, points = load_js(js)
curve_name = js[:js.find(".json")]
line.add(curve_name, x_axis, points, is_stack=True, is_label_show=True)
os.chdir(cwd)
line.render()
示例8: test_line_type_stack
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import render [as 别名]
def test_line_type_stack():
line = Line("折线图-数据堆叠示例")
line.add("商家A", CLOTHES, clothes_v1, is_stack=True, is_label_show=True)
line.add("商家B", CLOTHES, clothes_v2, is_stack=True, is_label_show=True)
line.render()
示例9: test_grid
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line 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],
#.........这里部分代码省略.........
示例10: test_line
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import render [as 别名]
def test_line():
# line_0
attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
v1 = [5, 20, 36, 10, 10, 100]
v2 = [55, 60, 16, 20, 15, 80]
line = Line("折线图示例")
line.add("商家A", attr, v1, mark_point=["average"])
line.add("商家B", attr, v2, is_smooth=True, mark_line=["max", "average"])
line.show_config()
line.render()
# line_0_1
line = Line("折线图示例")
line.add("商家A", attr, v1, mark_point=["average", "max", "min"],
mark_point_symbol='diamond', mark_point_textcolor='#40ff27')
line.add("商家B", attr, v2, mark_point=["average", "max", "min"],
mark_point_symbol='arrow', mark_point_symbolsize=40)
line.show_config()
line.render()
# line_1
line = Line("折线图-数据堆叠示例")
line.add("商家A", attr, v1, is_stack=True, is_label_show=True)
line.add("商家B", attr, v2, is_stack=True, is_label_show=True)
line.show_config()
line.render()
# line_2
line = Line("折线图-阶梯图示例")
line.add("商家A", attr, v1, is_step=True, is_label_show=True)
line.show_config()
line.render()
# # line_3
line = Line("折线图-面积图示例")
line.add("商家A", attr, v1, is_fill=True, line_opacity=0.2, area_opacity=0.4, symbol=None)
line.add("商家B", attr, v2, is_fill=True, area_color='#000', area_opacity=0.3, is_smooth=True)
line.show_config()
line.render()
# line_4
attr = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
line = Line("折线图示例")
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"])
line.show_config()
line.render()
示例11: range
# 需要导入模块: from pyecharts import Line [as 别名]
# 或者: from pyecharts.Line import render [as 别名]
#折线图适合描述两个变量之间的函数关系,例如常用它来描述一个变量随时间的变化趋势。
from pyecharts import Line
x = ['2018-{:0>2d}'.format(s) for s in range(1,13)]
y1 = [5,10,26,30,35,30,20,26,40,46,40,50]
y2 = [8,20,24,36,40,36,40,45,50,53,48,58]
line = Line(title = "月销售总额",width = 600,height = 420)
line.add(name = "商家A", x_axis = x, y_axis = y1,
line_width = 3,line_color = 'red',
#=====设置markPoint&markLine=====
mark_point = ['min','max'], #标记点
mark_line = ['average'] #标记线
)
line.add(name = "商家B", x_axis = x, y_axis = y2,
yaxis_min = 0,yaxis_max = 100,is_xaxis_boundarygap = False,
is_datazoom_show =True,line_width = 2,line_color = 'cyan',
#=====设置markPoint&markLine=====
mark_point = [
{"coord": ['2018-09', 60], "name": "2018/09销售目标"},
{"coord": ['2018-11', 80], "name": "2018/10销售目标"}] # 自定义标记点
)
line.render('result.折线图示范.html')
line