Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2e22e51

Browse files
committed
Deprecate LocatableAxesBase and make it a no-op.
All its functionality is provided by the matplotlib.axes.Axes class now so it does not need to exist as all alternative Axes classes derive from the main one.
1 parent 6dc0e2f commit 2e22e51

File tree

1 file changed

+7
-41
lines changed

1 file changed

+7
-41
lines changed

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import matplotlib.transforms as mtransforms
2020

21+
from matplotlib import cbook
2122
from matplotlib.axes import SubplotBase
2223

2324
from . import axes_size as Size
@@ -882,48 +883,13 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
882883
return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
883884

884885

886+
@cbook.deprecated('2.2',
887+
addendum=' There is no alternative. Deriving from '
888+
'matplotlib.axes.Axes provides this functionality '
889+
'already.')
885890
class LocatableAxesBase(object):
886-
def __init__(self, *kl, **kw):
891+
pass
887892

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
927893

928894
_locatableaxes_classes = {}
929895

@@ -933,7 +899,7 @@ def locatable_axes_factory(axes_class):
933899
new_class = _locatableaxes_classes.get(axes_class)
934900
if new_class is None:
935901
new_class = type(str("Locatable%s" % (axes_class.__name__)),
936-
(LocatableAxesBase, axes_class),
902+
(axes_class, ),
937903
{'_axes_class': axes_class})
938904

939905
_locatableaxes_classes[axes_class] = new_class

0 commit comments

Comments
 (0)