8000 MNT: Remove properties and methods from Subplot · matplotlib/matplotlib@461a127 · GitHub
[go: up one dir, main page]

Skip to content

Commit 461a127

Browse files
committed
MNT: Remove properties and methods from Subplot
This follows the deprecation period.
1 parent 25f4059 commit 461a127

File tree

2 files changed

+10
-56
lines changed

2 files changed

+10
-56
lines changed

doc/api/next_api_changes/removals/23XXX-GL.rst renamed to doc/api/next_api_changes/removals/23093-GL.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,11 @@ Deprecated properties of widgets have been removed
4040

4141
These include ``cids``, ``cnt``, ``observers``, ``change_observers``,
4242
and ``submit_observers``.
43+
44+
Removal of methods and properties of ``Subplot``
45+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46+
47+
These include ``get_geometry()``, ``change_geometry()``, ``figbox``,
48+
``numRows``, ``numCols``, ``update_params()``, ``is_first_row()``,
49+
``is_first_col()``, ``is_last_row()``, ``is_last_col()``. The subplotspec
50+
contains this information and can be used to replace these methods and properties.

lib/matplotlib/axes/_subplots.py

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import matplotlib as mpl
2-
from matplotlib import _api, cbook
2+
from matplotlib import cbook
33
from matplotlib.axes._axes import Axes
4-
from matplotlib.gridspec import GridSpec, SubplotSpec
4+
from matplotlib.gridspec import SubplotSpec
55

66

77
class SubplotBase:
@@ -35,22 +35,6 @@ def __init__(self, fig, *args, **kwargs):
3535
# This will also update the axes position.
3636
self.set_subplotspec(SubplotSpec._from_subplot_args(fig, args))
3737

38-
@_api.deprecated(
39-
"3.4", alternative="get_subplotspec",
40-
addendum="(get_subplotspec returns a SubplotSpec instance.)")
41-
def get_geometry(self):
42-
"""Get the subplot geometry, e.g., (2, 2, 3)."""
43-
rows, cols, num1, num2 = self.get_subplotspec().get_geometry()
44-
return rows, cols, num1 + 1 # for compatibility
45-
46-
@_api.deprecated("3.4", alternative="set_subplotspec")
47-
def change_geometry(self, numrows, numcols, num):
48-
"""Change subplot geometry, e.g., from (1, 1, 1) to (2, 2, 3)."""
49-
self._subplotspec = GridSpec(numrows, numcols,
50-
figure=self.figure)[num - 1]
51-
self.update_params()
52-
self.set_position(self.figbox)
53-
5438
def get_subplotspec(self):
5539
"""Return the `.SubplotSpec` instance associated with the subplot."""
5640
return self._subplotspec
@@ -64,44 +48,6 @@ def get_gridspec(self):
6448
"""Return the `.GridSpec` instance associated with the subplot."""
6549
return self._subplotspec.get_gridspec()
6650

67-
@_api.deprecated(
68-
"3.4", alternative="get_position()")
69-
@property
70-
def figbox(self):
71-
return self.get_position()
72-
73-
@_api.deprecated("3.4", alternative="get_gridspec().nrows")
74-
@property
75-
def numRows(self):
76-
return self.get_gridspec().nrows
77-
78-
@_api.deprecated("3.4", alternative="get_gridspec().ncols")
79-
@property
80-
def numCols(self):
81-
return self.get_gridspec().ncols
82-
83-
@_api.deprecated("3.4")
84-
def update_params(self):
85-
"""Update the subplot position from ``self.figure.subplotpars``."""
86-
# Now a no-op, as figbox/numRows/numCols are (deprecated) auto-updating
87-
# properties.
88-
89-
@_api.deprecated("3.4", alternative="ax.get_subplotspec().is_first_row()")
90-
def is_first_row(self):
91-
return self.get_subplotspec().rowspan.start == 0
92-
93-
@_api.deprecated("3.4", alternative="ax.get_subplotspec().is_last_row()")
94-
def is_last_row(self):
95-
return self.get_subplotspec().rowspan.stop == self.get_gridspec().nrows
96-
97-
@_api.deprecated("3.4", alternative="ax.get_subplotspec().is_first_col()")
98-
def is_first_col(self):
99-
return self.get_subplotspec().colspan.start == 0
100-
101-
@_api.deprecated("3.4", alternative="ax.get_subplotspec().is_last_col()")
102-
def is_last_col(self):
103-
return self.get_subplotspec().colspan.stop == self.get_gridspec().ncols
104-
10551
def label_outer(self):
10652
"""
10753
Only show "outer" labels and tick labels.

0 commit comments

Comments
 (0)
0