@@ -1007,51 +1007,52 @@ class DateConverter(units.ConversionInterface):
10071007 """The units are equivalent to the timezone."""
10081008
10091009 @staticmethod
1010- def axisinfo (axis , unit ):
1010+ def axisinfo (unit , axis ):
10111011 'return the unit AxisInfo'
10121012 # make sure that the axis does not start at 0
1013- ax = axis .axes
1014-
1015- if axis is ax .get_xaxis ():
1016- xmin , xmax = ax .dataLim .intervalx
1017- if xmin == 0. :
1018- # no data has been added - let's set the default datalim.
1019- # We should probably use a better proxy for the datalim
1020- # have been updated than the ignore setting
1021- dmax = today = datetime .date .today ()
1022- dmin = today - datetime .timedelta (days = 10 )
1023-
1024- ax ._process_unit_info (xdata = (dmin , dmax ))
1025- dmin , dmax = ax .convert_xunits ([dmin , dmax ])
1026-
1027- ax .viewLim .intervalx = dmin , dmax
1028- ax .dataLim .intervalx = dmin , dmax
1029- elif axis is ax .get_yaxis ():
1030- ymin , ymax = ax .dataLim .intervaly
1031- if ymin == 0. :
1032- # no data has been added - let's set the default datalim.
1033- # We should probably use a better proxy for the datalim
1034- # have been updated than the ignore setting
1035- dmax = today = datetime .date .today ()
1036- dmin = today - datetime .timedelta (days = 10 )
1037-
1038- ax ._process_unit_info (ydata = (dmin , dmax ))
1039- dmin , dmax = ax .convert_yunits ([dmin , dmax ])
1040-
1041- ax .viewLim .intervaly = dmin , dmax
1042- ax .dataLim .intervaly = dmin , dmax
1013+ if axis :
1014+ ax = axis .axes
1015+
1016+ if axis is ax .get_xaxis ():
1017+ xmin , xmax = ax .dataLim .intervalx
1018+ if xmin == 0. :
1019+ # no data has been added - let's set the default datalim.
1020+ # We should probably use a better proxy for the datalim
1021+ # have been updated than the ignore setting
1022+ dmax = today = datetime .date .today ()
1023+ dmin = today - datetime .timedelta (days = 10 )
1024+
1025+ ax ._process_unit_info (xdata = (dmin , dmax ))
1026+ dmin , dmax = ax .convert_xunits ([dmin , dmax ])
1027+
1028+ ax .viewLim .intervalx = dmin , dmax
1029+ ax .dataLim .intervalx = dmin , dmax
1030+ elif axis is ax .get_yaxis ():
1031+ ymin , ymax = ax .dataLim .intervaly
1032+ if ymin == 0. :
1033+ # no data has been added - let's set the default datalim.
1034+ # We should probably use a better proxy for the datalim
1035+ # have been updated than the ignore setting
1036+ dmax = today = datetime .date .today ()
1037+ dmin = today - datetime .timedelta (days = 10 )
1038+
1039+ ax ._process_unit_info (ydata = (dmin , dmax ))
1040+ dmin , dmax = ax .convert_yunits ([dmin , dmax ])
1041+
1042+ ax .viewLim .intervaly = dmin , dmax
1043+ ax .dataLim .intervaly = dmin , dmax
10431044
10441045 majloc = AutoDateLocator (tz = unit )
10451046 majfmt = AutoDateFormatter (majloc , tz = unit )
10461047 return units .AxisInfo ( majloc = majloc , majfmt = majfmt , label = '' )
10471048
10481049 @staticmethod
1049- def convert (axis , value , unit ):
1050+ def convert (value , unit , axis ):
10501051 if units .ConversionInterface .is_numlike (value ): return value
10511052 return date2num (value )
10521053
10531054 @staticmethod
1054- def default_units (axis , x ):
1055+ def default_units (x , axis ):
10551056 'Return the default unit for *x* or None'
10561057 return None
10571058
0 commit comments