发布时间:2019-09-15 09:57:05编辑:auto阅读(2447)
利用python生成曲线图像的脚本,参考自:http://www.lorenzogil.com/projects/pycha/
- import cairo
 - import pycha.bar
 - width,height=500,400
 - surface=cairo.ImageSurface(cairo.FORMAT_ARGB32,width,height)
 - dataSet=(
 - ('dateset1',((0,1),(1,3),(2,2.5))),
 - ('dateset2',((0,2),(1,4),(2,3))),
 - ('dateset3',((0,5),(1,1,),(2,0.5))),
 - )
 - options={
 - 'legend':{'hide':False},
 - 'background':{'color': '#f0f0f0'},
 - }
 - chart=pycha.bar.VerticalBarChart(surface,options)
 - chart.addDataset(dataSet)
 - chart.render()
 - surface.write_to_png('test.png')
 
效果图:
上一篇: python 实现 自动 svn che
下一篇: 安装金碟K3客户端
 51245
 50682
 41283
 38103
 32566
 29467
 28330
 23192
 23157
 21485
 1559°
 2278°
 1886°
 1825°
 2139°
 1872°
 2560°
 4293°
 4147°
 2955°