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

Skip to content

Commit 7af9b9a

Browse files
committed
Expire mpl_toolkits deprecations.
1 parent 447c0c8 commit 7af9b9a

File tree

6 files changed

+25
-150
lines changed

6 files changed

+25
-150
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Removed deprecated APIs
2+
~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The following deprecated APIs have been removed:
5+
6+
- In the `~.axes_size` module, the following classes: ``AddList`` (use
7+
``sum(sizes, start=Fixed(0))`` instead), ``Padded`` (use ``size + pad``
8+
instead), ``SizeFromFunc``, ``GetExtentHelper``.
9+
- ``AxisArtistHelper.delta1``, ``AxisArtistHelper.delta2``,
10+
``GridHelperBase.new_gridlines``, ``GridHelperRectlinear.new_gridlines``.
11+
- ``Axes3D.dist``, ``axis3d.Axis.set_pane_pos``, ``axis3d.move_from_center``,
12+
``axis3d.tick_update_position``.
13+
- Support for positionally passing arguments *emit* and *auto* to
14+
`.Axes.set_xlim`, `.Axes.set_ylim`, and `.Axes3D.set_zlim`.
15+
16+
Unless a replacement is stated, inline the previous definition if the
17+
functionality is still needed.

lib/matplotlib/axes/_base.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3568,9 +3568,8 @@ def _validate_converted_limits(self, limit, convert):
35683568
raise ValueError("Axis limits cannot be NaN or Inf")
35693569
return converted_limit
35703570

3571-
@_api.make_keyword_only("3.6", "emit")
3572-
def set_xlim(self, left=None, right=None, emit=True, auto=False,
3573-
*, xmin=None, xmax=None):
3571+
def set_xlim(self, left=None, right=None, *,
3572+
emit=True, auto=False, xmin=None, xmax=None):
35743573
"""
35753574
Set the x-axis view limits.
35763575
@@ -3800,9 +3799,8 @@ def get_ylim(self):
38003799
"""
38013800
return tuple(self.viewLim.intervaly)
38023801

3803-
@_api.make_keyword_only("3.6", "emit")
3804-
def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
3805-
*, ymin=None, ymax=None):
3802+
def set_ylim(self, bottom=None, top=None, *,
3803+
emit=True, auto=False, ymin=None, ymax=None):
38063804
"""
38073805
Set the y-axis view limits.
38083806

lib/mpl_toolkits/axes_grid1/axes_size.py

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ def get_size(self, renderer):
3737
return a_rel_size + b_rel_size, a_abs_size + b_abs_size
3838

3939

40-
@_api.deprecated(
41-
"3.6", alternative="sum(sizes, start=Fixed(0))")
42-
class AddList(_Base):
43-
def __init__(self, add_list):
44-
self._list = add_list
45-
46-
def get_size(self, renderer):
47-
sum_rel_size = sum([a.get_size(renderer)[0] for a in self._list])
48-
sum_abs_size = sum([a.get_size(renderer)[1] for a in self._list])
49-
return sum_rel_size, sum_abs_size
50-
51-
5240
class Fixed(_Base):
5341
"""
5442
Simple fixed size with absolute part = *fixed_size* and relative part = 0.
@@ -204,24 +192,6 @@ def get_size(self, renderer):
204192
return rel_size, abs_size
205193

206194

207-
@_api.deprecated("3.6", alternative="size + pad")
208-
class Padded(_Base):
209-
"""
210-
Return an instance where the absolute part of *size* is
211-
increase by the amount of *pad*.
212-
"""
213-
214-
def __init__(self, size, pad):
215-
self._size = size
216-
self._pad = pad
217-
218-
def get_size(self, renderer):
219-
r, a = self._size.get_size(renderer)
220-
rel_size = r
221-
abs_size = a + self._pad
222-
return rel_size, abs_size
223-
224-
225195
def from_any(size, fraction_ref=None):
226196
"""
227197
Create a Fixed unit when the first argument is a float, or a
@@ -239,43 +209,6 @@ def from_any(size, fraction_ref=None):
239209
raise ValueError("Unknown format")
240210

241211

242-
@_api.deprecated("3.6")
243-
class SizeFromFunc(_Base):
244-
def __init__(self, func):
245-
self._func = func
246-
247-
def get_size(self, renderer):
248-
rel_size = 0.
249-
250-
bb = self._func(renderer)
251-
dpi = renderer.points_to_pixels(72.)
252-
abs_size = bb/dpi
253-
254-
return rel_size, abs_size
255-
256-
257-
@_api.deprecated("3.6")
258-
class GetExtentHelper:
259-
_get_func_map = {
260-
"left": lambda self, axes_bbox: axes_bbox.xmin - self.xmin,
261-
"right": lambda self, axes_bbox: self.xmax - axes_bbox.xmax,
262-
"bottom": lambda self, axes_bbox: axes_bbox.ymin - self.ymin,
263-
"top": lambda self, axes_bbox: self.ymax - axes_bbox.ymax,
264-
}
265-
266-
def __init__(self, ax, direction):
267-
_api.check_in_list(self._get_func_map, direction=direction)
268-
self._ax_list = [ax] if isinstance(ax, Axes) else ax
269-
self._direction = direction
270-
271-
def __call__(self, renderer):
272-
get_func = self._get_func_map[self._direction]
273-
vl = [get_func(ax.get_tightbbox(renderer, call_axes_locator=False),
274-
ax.bbox)
275-
for ax in self._ax_list]
276-
return max(vl)
277-
278-
279212
class _AxesDecorationsSize(_Base):
280213
"""
281214
Fixed size, corresponding to the size of decorations on a given Axes side.

lib/mpl_toolkits/axisartist/axislines.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ class _Base:
9090
def update_lim(self, axes):
9191
pass
9292

93-
delta1 = _api.deprecated("3.6")(
94-
property(lambda self: 0.00001, lambda self, value: None))
95-
delta2 = _api.deprecated("3.6")(
96-
property(lambda self: 0.00001, lambda self, value: None))
97-
9893
def _to_xy(self, values, const):
9994
"""
10095
Create a (*values.shape, 2)-shape array representing (x, y) pairs.
@@ -323,29 +318,6 @@ def get_gridlines(self, which, axis):
323318
"""
324319
return []
325320

326-
@_api.deprecated("3.6")
327-
def new_gridlines(self, ax):
328-
"""
329-
Create and return a new GridlineCollection instance.
330-
331-
*which* : "major" or "minor"
332-
*axis* : "both", "x" or "y"
333-
334-
"""
335-
gridlines = GridlinesCollection(
336-
None, transform=ax.transData, colors=mpl.rcParams['grid.color'],
337-
linestyles=mpl.rcParams['grid.linestyle'],
338-
linewidths=mpl.rcParams['grid.linewidth'])
339-
ax._set_artist_props(gridlines)
340-
gridlines.set_grid_helper(self)
341-
342-
ax.axes._set_artist_props(gridlines)
343-
# gridlines.set_clip_path(self.axes.patch)
344-
# set_clip_path need to be deferred after Axes.cla is completed.
345-
# It is done inside the cla.
346-
347-
return gridlines
348-
349321

350322
class GridHelperRectlinear(GridHelperBase):
351323

@@ -455,21 +427,6 @@ def toggle_axisline(self, b=None):
455427
def axis(self):
456428
return self._axislines
457429

458-
@_api.deprecated("3.6")
459-
def new_gridlines(self, grid_helper=None):
460-
"""
461-
Create and return a new GridlineCollection instance.
462-
463-
*which* : "major" or "minor"
464-
*axis* : "both", "x" or "y"
465-
466-
"""
467-
if grid_helper is None:
468-
grid_helper = self.get_grid_helper()
469-
470-
gridlines = grid_helper.new_gridlines(self)
471-
return gridlines
472-
473430
def clear(self):
474431
# docstring inherited
475432

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class Axes3D(Axes):
5757
_axis_names = ("x", "y", "z")
5858
Axes._shared_axes["z"] = cbook.Grouper()
5959

60-
dist = _api.deprecate_privatize_attribute("3.6")
6160
vvec = _api.deprecate_privatize_attribute("3.7")
6261
eye = _api.deprecate_privatize_attribute("3.7")
6362
sx = _api.deprecate_privatize_attribute("3.7")
@@ -683,9 +682,8 @@ def get_w_lims(self):
683682
return minx, maxx, miny, maxy, minz, maxz
684683

685684
# set_xlim, set_ylim are directly inherited from base Axes.
686-
@_api.make_keyword_only("3.6", "emit")
687-
def set_zlim(self, bottom=None, top=None, emit=True, auto=False,
688-
*, zmin=None, zmax=None):
685+
def set_zlim(self, bottom=None, top=None, *,
686+
emit=True, auto=False, zmin=None, zmax=None):
689687
"""
690688
Set 3D z limits.
691689

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@
1313
from . import art3d, proj3d
1414

1515

16-
@_api.deprecated("3.6", alternative="a vendored copy of _move_from_center")
17-
def move_from_center(coord, centers, deltas, axmask=(True, True, True)):
18-
"""
19-
For each coordinate where *axmask* is True, move *coord* away from
20-
*centers* by *deltas*.
21-
"""
22-
return _move_from_center(coord, centers, deltas, axmask=axmask)
23-
24-
2516
def _move_from_center(coord, centers, deltas, axmask=(True, True, True)):
2617
"""
2718
For each coordinate where *axmask* is True, move *coord* away from
@@ -31,12 +22,6 @@ def _move_from_center(coord, centers, deltas, axmask=(True, True, True)):
3122
return coord + axmask * np.copysign(1, coord - centers) * deltas
3223

3324

34-
@_api.deprecated("3.6", alternative="a vendored copy of _tick_update_position")
35-
def tick_update_position(tick, tickxs, tickys, labelpos):
36-
"""Update tick line and label position and style."""
37-
_tick_update_position(tick, tickxs, tickys, labelpos)
38-
39-
4025
def _tick_update_position(tick, tickxs, tickys, labelpos):
4126
"""Update tick line and label position and style."""
4227

@@ -198,17 +183,6 @@ def get_minor_ticks(self, numticks=None):
198183
obj.set_transform(self.axes.transData)
199184
return ticks
200185

201-
@_api.deprecated("3.6")
202-
def set_pane_pos(self, xys):
203-
"""Set pane position."""
204-
self._set_pane_pos(xys)
205-
206-
def _set_pane_pos(self, xys):
207-
xys = np.asarray(xys)
208-
xys = xys[:, :2]
209-
self.pane.xy = xys
210-
self.stale = True
211-
212186
def set_pane_color(self, color, alpha=None):
213187
"""
214188
Set pane color.
@@ -333,14 +307,12 @@ def draw_pane(self, renderer):
333307

334308
mins, maxs, centers, deltas, tc, highs = self._get_coord_info(renderer)
335309

336-
info = self._axinfo
337-
index = info['i']
310+
index = self._axinfo['i']
338311
if not highs[index]:
339312
plane = self._PLANES[2 * index]
340313
else:
341314
plane = self._PLANES[2 * index + 1]
342-
xys = [tc[p] for p in plane]
343-
self._set_pane_pos(xys)
315+
self.pane.set_xy([tc[p][:2] for p in plane])
344316
self.pane.draw(renderer)
345317

346318
renderer.close_group('pane3d')

0 commit comments

Comments
 (0)