From: Javier Olaechea <pirata@gm...> - 2009-09-07 17:23:05
Oi, I'm having trouble ploting some values vs date with matplotlib.
I get the data from an SQL server using the _mssql module
after the query I tried populating the list using:
xls = 
yls = 
for row in conn:
The row['tiempo'] is datetime in the SQL table so I get yls filled
with datetime objects
At first I tried displaying it in an YYYYMMDDhhmm format using
temp = row['tiempo']
temp = str(temp.year) + '-' + str(temp.month) + '-' + str(temp.hour)
+'-' + str(temp.minute)
temp = int(temp)
but after seeing that matplotlib by default uses an exponential
notation y then realized that the scale would be off.
If I use date2num() it displays numbers not dates.
Basically I would like to plot the data against dates, with the
ability to autoscale from a minutes view to a month view at least. The
data set is failry large, at least 1 year of data from 5 minutes apart
Any pointers in the right direction? Can I plot dates without
converting them to a number? If not could the numbers be linked to
back to the date and the date be displayed in the axis instead of the
Thanks for your time.
Get latest updates about Open Source Projects, Conferences and News.