2012-12-31 72 views
-2

我使用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') 
+0

醜陋到底是什麼意思? – tacaswell

+0

Sclae es很奇怪,它只是一條線沒有填充和任何其他的消化,使它看起來更愉快 – Aman

+0

你可以發佈圖像的任何地方?你是什​​麼意思,規模是奇怪的?你只畫一條線,你期望什麼? – tacaswell

回答

2

matplotlib文檔具有的一個例子的漂亮gallery(用代碼)。