18
18
19
19
import matplotlib .transforms as mtransforms
20
20
21
+ from matplotlib import cbook
21
22
from matplotlib .axes import SubplotBase
22
23
23
24
from . import axes_size as Size
@@ -882,48 +883,13 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
882
883
return mtransforms .Bbox .from_bounds (x1 , y1 , w1 , h1 )
883
884
884
885
886
+ @cbook .deprecated ('2.2' ,
887
+ addendum = ' There is no alternative. Deriving from '
888
+ 'matplotlib.axes.Axes provides this functionality '
889
+ 'already.' )
885
890
class LocatableAxesBase (object ):
886
- def __init__ ( self , * kl , ** kw ):
891
+ pass
887
892
888
- self ._axes_class .__init__ (self , * kl , ** kw )
889
-
890
- self ._locator = None
891
- self ._locator_renderer = None
892
-
893
- def set_axes_locator (self , locator ):
894
- self ._locator = locator
895
-
896
- def get_axes_locator (self ):
897
- return self ._locator
898
-
899
- def apply_aspect (self , position = None ):
900
-
901
- if self .get_axes_locator () is None :
902
- self ._axes_class .apply_aspect (self , position )
903
- else :
904
- pos = self .get_axes_locator ()(self , self ._locator_renderer )
905
- self ._axes_class .apply_aspect (self , position = pos )
906
-
907
- def draw (self , renderer = None , inframe = False ):
908
-
909
- self ._locator_renderer = renderer
910
-
911
- self ._axes_class .draw (self , renderer , inframe )
912
-
913
- def _make_twin_axes (self , * kl , ** kwargs ):
914
- """
915
- Need to overload so that twinx/twiny will work with
916
- these axes.
917
- """
918
- if 'sharex' in kwargs and 'sharey' in kwargs :
919
- raise ValueError ("Twinned Axes may share only one axis." )
920
- ax2 = type (self )(self .figure , self .get_position (True ), * kl , ** kwargs )
921
- ax2 .set_axes_locator (self .get_axes_locator ())
922
- self .figure .add_axes (ax2 )
923
- self .set_adjustable ('datalim' )
924
- ax2 .set_adjustable ('datalim' )
925
- self ._twinned_axes .join (self , ax2 )
926
- return ax2
927
893
928
894
_locatableaxes_classes = {}
929
895
@@ -933,7 +899,7 @@ def locatable_axes_factory(axes_class):
933
899
new_class = _locatableaxes_classes .get (axes_class )
934
900
if new_class is None :
935
901
new_class = type (str ("Locatable%s" % (axes_class .__name__ )),
936
- (LocatableAxesBase , axes_class ),
902
+ (axes_class , ),
937
903
{'_axes_class' : axes_class })
938
904
939
905
_locatableaxes_classes [axes_class ] = new_class
0 commit comments