>>C M wrote:
> 1. What exactly must I import (which modules) and how do I import them
> (in the sense of "import x" vs. "from x import y")?
> 2. What arguments does the plot_date() command take and what is format
> of the arguments?
> 3. Do I have to make the conversion from the date format above to the
> matplotlib date format?  If so, how?
<<

The code snippet below should answer most of your questions.

2 problems:

autofmt_xdate() did not rotate the minor tick label, I don't now how to
do that.

I could not figure out how to draw minor tick grid lines.

import datetime as DT
import pylab as P
import time

x = ['2007-09-01 12:00:02', '2007-09-02 12:00:02', '2007-09-03 12:00:02']
y = [10, 20, 30]
fmt='%Y-%m-%d %H:%M:%S'
x1=[DT.datetime(*time.strptime(d,fmt)[:6]) for d in x]
dates=P.date2num(x1)
fig = P.figure()
ax = fig.add_subplot(111)
ax.plot_date(dates, y)
ax.xaxis.set_major_locator( P.DayLocator() )
ax.xaxis.set_minor_locator( P.HourLocator(12))
ax.xaxis.set_major_formatter( P.DateFormatter('%Y-%m-%d') )
ax.xaxis.set_minor_formatter( P.DateFormatter('%Y-%m-%d %H:%M:%S'))
ax.grid(True)
fig.autofmt_xdate()
P.show()

-- 
Bill

[EMAIL PROTECTED]

Gentoo Linux X86_64 2.6.20-gentoo-r8

Reclaim Your Inbox with http://www.mozilla.org/products/thunderbird/

All things cometh to he who waiteth as long as he who waiteth worketh like hell 
while he waiteth.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to