Skip to content

Commit 15d9b8e

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 ff6139c commit 15d9b8e

File tree

1 file changed

+7
-42
lines changed

1 file changed

+7
-42
lines changed

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import functools
1414

1515
import matplotlib.transforms as mtransforms
16+
from matplotlib import cbook
1617
from matplotlib.axes import SubplotBase
1718
from . import axes_size as Size
1819

@@ -863,54 +864,18 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
863864
return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
864865

865866

867+
@cbook.deprecated('3.0',
868+
addendum=' There is no alternative. Deriving from '
869+
'matplotlib.axes.Axes provides this functionality '
870+
'already.')
866871
class LocatableAxesBase(object):
867-
def __init__(self, *kl, **kw):
868-
869-
self._axes_class.__init__(self, *kl, **kw)
870-
871-
self._locator = None
872-
self._locator_renderer = None
873-
874-
def set_axes_locator(self, locator):
875-
self._locator = locator
876-
877-
def get_axes_locator(self):
878-
return self._locator
879-
880-
def apply_aspect(self, position=None):
881-
882-
if self.get_axes_locator() is None:
883-
self._axes_class.apply_aspect(self, position)
884-
else:
885-
pos = self.get_axes_locator()(self, self._locator_renderer)
886-
self._axes_class.apply_aspect(self, position=pos)
887-
888-
def draw(self, renderer=None, inframe=False):
889-
890-
self._locator_renderer = renderer
891-
892-
self._axes_class.draw(self, renderer, inframe)
893-
894-
def _make_twin_axes(self, *kl, **kwargs):
895-
"""
896-
Need to overload so that twinx/twiny will work with
897-
these axes.
898-
"""
899-
if 'sharex' in kwargs and 'sharey' in kwargs:
900-
raise ValueError("Twinned Axes may share only one axis.")
901-
ax2 = type(self)(self.figure, self.get_position(True), *kl, **kwargs)
902-
ax2.set_axes_locator(self.get_axes_locator())
903-
self.figure.add_axes(ax2)
904-
self.set_adjustable('datalim')
905-
ax2.set_adjustable('datalim')
906-
self._twinned_axes.join(self, ax2)
907-
return ax2
872+
pass
908873

909874

910875
@functools.lru_cache(None)
911876
def locatable_axes_factory(axes_class):
912877
return type("Locatable%s" % axes_class.__name__,
913-
(LocatableAxesBase, axes_class),
878+
(axes_class, ),
914879
{'_axes_class': axes_class})
915880

916881

0 commit comments

Comments
 (0)