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:

[code]
xls = []
yls = []

for row in conn:
        xls.append(row['Ia'])
        yls.append(row['tiempo'])
[/code]

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
[code]
temp = row['tiempo']
temp = str(temp.year) + '-' + str(temp.month) + '-' + str(temp.hour)
+'-' + str(temp.minute)
temp = int(temp)
yls.append(temp)
[/code]

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
measurements.

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
numbers?

Thanks for your time.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to