@@ -641,9 +641,17 @@ def __call__(self):
641641 'Return the locations of the ticks'
642642 raise NotImplementedError ('Derived must override' )
643643
644+ def view_limits (self , vmin , vmax ):
645+ """
646+ select a scale for the range from vmin to vmax
647+
648+ Normally This will be overridden.
649+ """
650+ return mtransforms .nonsingular (vmin , vmax )
651+
644652 def autoscale (self ):
645653 'autoscale the view limits'
646- return mtransforms . nonsingular (* self .axis .get_view_interval ())
654+ return self . view_limits (* self .axis .get_view_interval ())
647655
648656 def pan (self , numsteps ):
649657 'Pan numticks (can be positive or negative)'
@@ -773,11 +781,9 @@ def __call__(self):
773781 def _set_numticks (self ):
774782 self .numticks = 11 # todo; be smart here; this is just for dev
775783
776- def autoscale (self ):
784+ def view_limits (self , vmin , vmax ):
777785 'Try to choose the view limits intelligently'
778786
779- vmin , vmax = self .axis .get_data_interval ()
780-
781787 if vmax < vmin :
782788 vmin , vmax = vmax , vmin
783789
@@ -859,13 +865,11 @@ def __call__(self):
859865 locs = vmin + np .arange (n + 1 ) * base
860866 return locs
861867
862- def autoscale (self ):
868+ def view_limits (self , dmin , dmax ):
863869 """
864870 Set the view limits to the nearest multiples of base that
865871 contain the data
866872 """
867- dmin , dmax = self .axis .get_data_interval ()
868-
869873 vmin = self ._base .le (dmin )
870874 vmax = self ._base .ge (dmax )
871875 if vmin == vmax :
@@ -946,8 +950,7 @@ def __call__(self):
946950 vmin , vmax = mtransforms .nonsingular (vmin , vmax , expander = 0.05 )
947951 return self .bin_boundaries (vmin , vmax )
948952
949- def autoscale (self ):
950- dmin , dmax = self .axis .get_data_interval ()
953+ def view_limits (self , dmin , dmax ):
951954 if self ._symmetric :
952955 maxabs = max (abs (dmin ), abs (dmax ))
953956 dmin = - maxabs
@@ -1043,9 +1046,9 @@ def __call__(self):
10431046
10441047 return np .array (ticklocs )
10451048
1046- def autoscale (self ):
1049+ def view_limits (self , vmin , vmax ):
10471050 'Try to choose the view limits intelligently'
1048- vmin , vmax = self . axis . get_data_interval ()
1051+
10491052 if vmax < vmin :
10501053 vmin , vmax = vmax , vmin
10511054
@@ -1114,10 +1117,9 @@ def __call__(self):
11141117 ticklocs = np .sign (decades ) * b ** np .abs (decades )
11151118 return np .array (ticklocs )
11161119
1117- def autoscale (self ):
1120+ def view_limits (self , vmin , vmax ):
11181121 'Try to choose the view limits intelligently'
11191122 b = self ._transform .base
1120- vmin , vmax = self .axis .get_data_interval ()
11211123 if vmax < vmin :
11221124 vmin , vmax = vmax , vmin
11231125
@@ -1167,13 +1169,12 @@ def refresh(self):
11671169 d = abs (vmax - vmin )
11681170 self ._locator = self .get_locator (d )
11691171
1170- def autoscale (self ):
1172+ def view_limits (self , vmin , vmax ):
11711173 'Try to choose the view limits intelligently'
11721174
1173- vmin , vmax = self .axis .get_data_interval ()
11741175 d = abs (vmax - vmin )
11751176 self ._locator = self .get_locator (d )
1176- return self ._locator .autoscale ( )
1177+ return self ._locator .view_limits ( vmin , vmax )
11771178
11781179 def get_locator (self , d ):
11791180 'pick the best locator based on a distance'
0 commit comments