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

Skip to content

Commit b9876ae

Browse files
committed
Deprecate any LocatableAxes in toolkits.
It's now no longer used for anything, since maxes.Axes is locatable already.
1 parent 57af905 commit b9876ae

File tree

4 files changed

+46
-19
lines changed

4 files changed

+46
-19
lines changed

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,17 @@ def make_axes_area_auto_adjustable(ax,
920920
divider.add_auto_adjustable_area(use_axes=use_axes, pad=pad,
921921
adjust_dirs=adjust_dirs)
922922

923-
#from matplotlib.axes import Axes
924-
from .mpl_axes import Axes
925-
LocatableAxes = Axes
923+
924+
from .mpl_axes import Axes as _Axes
925+
926+
927+
@cbook.deprecated('2.2',
928+
alternative='mpl_toolkits.axes_grid1.mpl_axes.Axes')
929+
class Axes(_Axes):
930+
pass
931+
932+
933+
@cbook.deprecated('2.2',
934+
alternative='mpl_toolkits.axes_grid1.mpl_axes.Axes')
935+
class LocatableAxes(_Axes):
936+
pass

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
import matplotlib.ticker as ticker
99
from matplotlib.gridspec import SubplotSpec
1010

11-
from .axes_divider import Size, SubplotDivider, LocatableAxes, Divider
11+
from .axes_divider import Size, SubplotDivider, Divider
1212
from .colorbar import Colorbar
13+
from .mpl_axes import Axes
1314

1415

1516
def _extend_axes_pad(value):
@@ -106,7 +107,7 @@ def toggle_label(self, b):
106107
#axis.label.set_visible(b)
107108

108109

109-
class CbarAxes(CbarAxesBase, LocatableAxes):
110+
class CbarAxes(CbarAxesBase, Axes):
110111
def __init__(self, *kl, **kwargs):
111112
orientation = kwargs.pop("orientation", None)
112113
if orientation is None:
@@ -115,10 +116,10 @@ def __init__(self, *kl, **kwargs):
115116
self._default_label_on = True
116117
self.locator = None
117118

118-
super(LocatableAxes, self).__init__(*kl, **kwargs)
119+
super(Axes, self).__init__(*kl, **kwargs)
119120

120121
def cla(self):
121-
LocatableAxes.cla(self)
122+
Axes.cla(self)
122123
self._config_axes()
123124

124125

@@ -132,7 +133,7 @@ class Grid(object):
132133
be easily done in matplotlib. AxesGrid is used in such case.
133134
"""
134135

135-
_defaultLocatableAxesClass = LocatableAxes
136+
_defaultAxesClass = Axes
136137

137138
def __init__(self, fig,
138139
rect,
@@ -192,12 +193,12 @@ def __init__(self, fig,
192193
self._direction = direction
193194

194195
if axes_class is None:
195-
axes_class = self._defaultLocatableAxesClass
196+
axes_class = self._defaultAxesClass
196197
axes_class_args = {}
197198
else:
198199
if (type(axes_class)) == type and \
199200
issubclass(axes_class,
200-
self._defaultLocatableAxesClass.Axes):
201+
self._defaultAxesClass.Axes):
201202
axes_class_args = {}
202203
else:
203204
axes_class, axes_class_args = axes_class
@@ -513,7 +514,7 @@ def __init__(self, fig,
513514
self._direction = direction
514515

515516
if axes_class is None:
516-
axes_class = self._defaultLocatableAxesClass
517+
axes_class = self._defaultAxesClass
517518
axes_class_args = {}
518519
else:
519520
if isinstance(axes_class, maxes.Axes):
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4+
from matplotlib import cbook
5+
46
from mpl_toolkits.axes_grid1.axes_divider import (
57
Divider, AxesLocator, SubplotDivider, AxesDivider, locatable_axes_factory,
68
make_axes_locatable)
79

8-
from mpl_toolkits.axisartist.axislines import Axes
9-
LocatableAxes = Axes
10+
from mpl_toolkits.axisartist.axislines import Axes as _Axes
11+
12+
13+
@cbook.deprecated('2.2',
14+
alternative='mpl_toolkits.axisartist.axislines.Axes')
15+
class Axes(_Axes):
16+
pass
17+
18+
19+
@cbook.deprecated('2.2',
20+
alternative='mpl_toolkits.axisartist.axislines.Axes')
21+
class LocatableAxes(_Axes):
22+
pass

lib/mpl_toolkits/axisartist/axes_grid.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
unicode_literals)
33

44
import mpl_toolkits.axes_grid1.axes_grid as axes_grid_orig
5-
from .axes_divider import LocatableAxes
5+
from .axislines import Axes
66

7-
class CbarAxes(axes_grid_orig.CbarAxesBase, LocatableAxes):
7+
8+
class CbarAxes(axes_grid_orig.CbarAxesBase, Axes):
89
def __init__(self, *kl, **kwargs):
910
orientation=kwargs.pop("orientation", None)
1011
if orientation is None:
@@ -13,18 +14,19 @@ def __init__(self, *kl, **kwargs):
1314
self._default_label_on = False
1415
self.locator = None
1516

16-
super(LocatableAxes, self).__init__(*kl, **kwargs)
17+
super(Axes, self).__init__(*kl, **kwargs)
1718

1819
def cla(self):
19-
super(LocatableAxes, self).cla()
20+
super(Axes, self).cla()
2021
self._config_axes()
2122

2223

2324
class Grid(axes_grid_orig.Grid):
24-
_defaultLocatableAxesClass = LocatableAxes
25+
_defaultAxesClass = Axes
26+
2527

2628
class ImageGrid(axes_grid_orig.ImageGrid):
27-
_defaultLocatableAxesClass = LocatableAxes
29+
_defaultAxesClass = Axes
2830
_defaultCbarAxesClass = CbarAxes
2931

3032
AxesGrid = ImageGrid

0 commit comments

Comments
 (0)