@@ -1218,21 +1218,21 @@ def grid(self, b=None, which='major', **kwargs):
12181218 def update_units (self , data ):
12191219 """
12201220 introspect *data* for units converter and update the
1221- axis.converter instance if necessary. Return *True* is *data* is
1222- registered for unit conversion
1221+ axis.converter instance if necessary. Return *True*
1222+ if *data* is registered for unit conversion.
12231223 """
12241224
12251225 converter = munits .registry .get_converter (data )
1226- if converter is None : return False
1226+ if converter is None :
1227+ return False
12271228
12281229 neednew = self .converter != converter
12291230 self .converter = converter
12301231 default = self .converter .default_units (data , self )
1231- #print 'update units: default="%s" , units=%s" '%(default, self.units)
1232+ #print 'update units: default=%s , units=%s'%(default, self.units)
12321233 if default is not None and self .units is None :
12331234 self .set_units (default )
12341235
1235-
12361236 if neednew :
12371237 self ._update_axisinfo ()
12381238 return True
@@ -1453,14 +1453,21 @@ def zoom(self, direction):
14531453 self .major .locator .zoom (direction )
14541454
14551455
1456- def axis_date (self ):
1456+ def axis_date (self , tz = None ):
14571457 """
14581458 Sets up x-axis ticks and labels that treat the x data as dates.
1459+ *tz* is a :class:`tzinfo` instance or a timezone string.
1460+ This timezone is used to create date labels.
14591461 """
1462+ # By providing a sample datetime instance with the desired
1463+ # timezone, the registered converter can be selected,
1464+ # and the "units" attribute, which is the timezone, can
1465+ # be set.
14601466 import datetime
1461- # should be enough to inform the unit conversion interface
1462- # dates are comng in
1463- self .update_units (datetime .date (2009 ,1 ,1 ))
1467+ if isinstance (tz , (str , unicode )):
1468+ import pytz
1469+ tz = pytz .timezone (tz )
1470+ self .update_units (datetime .datetime (2009 ,1 ,1 ,0 ,0 ,0 ,0 ,tz ))
14641471
14651472
14661473class XAxis (Axis ):
0 commit comments