On Tue, Jun 3, 2008 at 3:41 PM, Ted Drain <[EMAIL PROTECTED]> wrote: > At some point in the future, I'll put a little test case together to show > how the problems w/ not supporting a zero date show up in embedded plots.
Actually, when you pass in python datetime objects to mpl, we use the units converter infrastructure to convert these under the hood using date2num. This is fairly easy to override in the units registry. If you provide a registry to do conversions, locators and formatters for julian dates, I can easily include it with an rc setting to make a configurable default. The date interface is setup in the matplotlib.dates module with the following code -- all you have to do is provide a different converter and we can provide a hook class DateConverter(units.ConversionInterface): def axisinfo(unit): 'return the unit AxisInfo' if unit=='date': majloc = AutoDateLocator() majfmt = AutoDateFormatter(majloc) return units.AxisInfo( majloc = majloc, majfmt = majfmt, label='', ) else: return None axisinfo = staticmethod(axisinfo) def convert(value, unit): if units.ConversionInterface.is_numlike(value): return value return date2num(value) convert = staticmethod(convert) def default_units(x): 'return the default unit for x or None' return 'date' default_units = staticmethod(default_units) units.registry[datetime.date] = DateConverter() units.registry[datetime.datetime] = DateConverter() ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel