绘图工具——折线图
import random
from pyecharts import Line# 圖表的x軸的數據, 是一個可迭代的數據類型
x_times = list(range(0,30))
# 圖表的y軸的數據, 是一個可迭代的數據類型
y_temp_3 = [random.randint(20, 35) for i in range(30)]
y_temp_10 = [random.randint(20, 35) for j in range(30)]line = Line("折線圖")line.add("", x_times, y_temp_3, mark_line=['max'], mark_point=['min'])
line.add("", x_times, y_temp_10, mark_line=['max'], mark_point=['min'])# 折線圖---階梯圖
line.add("", x_times, y_temp_3, mark_line=['max'], mark_point=['min'], is_step=True)
line.add("", x_times, y_temp_10, mark_line=['max'], mark_point=['min'], is_step=True)# 折線圖---面積圖
# 設置透明度
line.add("", x_times, y_temp_3, is_fill=True, area_color='red', area_opacity=0.3)
line.add("", x_times, y_temp_10, is_fill=True, area_color='green', area_opacity=0.2)line.render()
總結
- 上一篇: WebXR教程大全之如何使用 A-Fra
- 下一篇: 多线程面试题之启动一个线程是run()还