API如下:
add_line(data, x=None, y=None, name=None, stroke_color=None, width=None)
实现:
import leather
# 数据
data1 = [[1.5,2],[2,3.5],[3,2.5],[4,4.8],[5,1.2]]
data2 = [[1.5,2],[2.3,4],[3,3],[4,2.3],[5,0.9]]
# 可视化
chart = leather.Chart("My Line Chart")
chart.add_line(data1, stroke_color='#0000ff', width=2, name="data1")
chart.add_line(data2, stroke_color='#ff0000', width=2, name="data2")
# 显示图像
chart.to_svg()
# 存储图像
# chart.to_svg("my_line_chart.svg")
结果: