我正在使用matplotlib绘制过去30分钟的温度图,读取存储在sqlite数据库中的温度和时间,格式为:time 1305 temp 26,我正在使用下面的代码,但是关于如何改进它,我的图表看起来真的很丑陋吗?
#!/usr/bin/env python
import os
import sqlite3
from matplotlib import pyplot
con = sqlite3.connect('growll.db')
con.text_factory = str
cur = con.cursor()
cur.execute("select temp from GrowLLDados ORDER BY id DESC LIMIT 30")
ar=[r[0] for r in cur.fetchall()]
cur.execute("select horabruta from GrowLLDados ORDER BY id DESC LIMIT 30")
br=[r[0] for r in cur.fetchall()]
pyplot.plot(br,ar)
x1,x2,y1,y2 = pyplot.axis()
pyplot.axis((x1,x2,y1-5,y2+5))
pyplot.savefig( 'Simple.png' )