From: John H. <jdh...@ac...> - 2004-05-27 14:35:30
|
>>>>> "Philippe" == Philippe Strauss <phi...@pr...> writes: Philippe> Hello, I would like to use plot_date, with a 'fill' Philippe> style of drawing. Is it possible to do that? date_plot doesn't do too much - it converts your dates to seconds since the epoch and sets a date ticker and formatter. You can do the same yourself, and then call whatever function you want. To borrow and adapt Peter's example above. import time from matplotlib.dates import EpochConverter from matplotlib.matlab import * from matplotlib.ticker import DateFormatter, DayLocator, HourLocator now=time.time() then=now-60*60*24*2 dates=arange(then, now, 20) #Say have a point every 20 secs.. vals= sin(0.001*pi*dates/60.0) fmt = DateFormatter('%D') days = DayLocator(1) hours = HourLocator(12) ax = subplot(111) ax.xaxis.set_major_locator(days) ax.xaxis.set_major_formatter(fmt) ax.xaxis.set_minor_locator(hours) fill(dates, vals) ax.autoscale_view() show() See http://matplotlib.sf.net/matplotlib.ticker.html for more information of tick locators and formaters. See http://matplotlib.sf.net/matplotlib.dates.html for info on how to convert your datetime instances to seconds since the epoch. Cheers, JDH |