Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 803df21

Browse filesBrowse files
authored
Merge pull request #23093 from greglucas/dep-34
MNT: Removing 3.4 deprecations
2 parents 9c5a749 + 461a127 commit 803df21
Copy full SHA for 803df21

File tree

Expand file treeCollapse file tree

13 files changed

+64
-201
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

13 files changed

+64
-201
lines changed
Open diff view settings
Collapse file
+50Lines changed: 50 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Get/set window title methods have been removed from the canvas
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Use the corresponding methods on the FigureManager if using pyplot,
5+
or GUI-specific methods if embedding.
6+
7+
``ContourLabeler.get_label_coords()`` has been removed
8+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9+
10+
There is no replacement, it was considered an internal helper.
11+
12+
The **return_all** keyword argument has been removed from ``gridspec.get_position()``
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14+
15+
The **minimum_descent** has been removed from ``TextArea``
16+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17+
18+
The minimum_descent is now effectively always True.
19+
20+
Extra parameters to Axes constructor
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+
23+
Parameters of the Axes constructor other than *fig* and *rect* are now keyword only.
24+
25+
``sphinext.plot_directive.align`` has been removed
26+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27+
28+
Use ``docutils.parsers.rst.directives.images.Image.align`` instead.
29+
30+
``imread()`` no longer accepts URLs
31+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+
33+
Passing a URL to `~.pyplot.imread()` has been removed. Please open the URL for
34+
reading and directly use the Pillow API
35+
(``PIL.Image.open(urllib.request.urlopen(url))``, or
36+
``PIL.Image.open(io.BytesIO(requests.get(url).content))``) instead.
37+
38+
Deprecated properties of widgets have been removed
39+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40+
41+
These include ``cids``, ``cnt``, ``observers``, ``change_observers``,
42+
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.
Collapse file

‎lib/matplotlib/axes/_base.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ def __str__(self):
570570
return "{0}({1[0]:g},{1[1]:g};{1[2]:g}x{1[3]:g})".format(
571571
type(self).__name__, self._position.bounds)
572572

573-
@_api.make_keyword_only("3.4", "facecolor")
574573
def __init__(self, fig, rect,
574+
*,
575575
facecolor=None, # defaults to rc axes.facecolor
576576
frameon=True,
577577
sharex=None, # use Axes instance's xaxis info
Collapse file

‎lib/matplotlib/axes/_subplots.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_subplots.py
+2-56Lines 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.
Collapse file

‎lib/matplotlib/backend_bases.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
-20Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,26 +2307,6 @@ def get_default_filetype(cls):
23072307
"""
23082308
return rcParams['savefig.format']
23092309

2310-
@_api.deprecated("3.4", alternative="`.FigureManagerBase.get_window_title`"
2311-
" or GUI-specific methods")
2312-
def get_window_title(self):
2313-
"""
2314-
Return the title text of the window containing the figure, or None
2315-
if there is no window (e.g., a PS backend).
2316-
"""
2317-
if self.manager is not None:
2318-
return self.manager.get_window_title()
2319-
2320-
@_api.deprecated("3.4", alternative="`.FigureManagerBase.set_window_title`"
2321-
" or GUI-specific methods")
2322-
def set_window_title(self, title):
2323-
"""
2324-
Set the title text of the window containing the figure. Note that
2325-
this has no effect if there is no window (e.g., a PS backend).
2326-
"""
2327-
if self.manager is not None:
2328-
self.manager.set_window_title(title)
2329-
23302310
def get_default_filename(self):
23312311
"""
23322312
Return a string, which includes extension, suitable for use as
Collapse file

‎lib/matplotlib/cbook/__init__.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ def __setstate__(self, state):
206206
s: {proxy: cid for cid, proxy in d.items()}
207207
for s, d in self.callbacks.items()}
208208

209-
@_api.rename_parameter("3.4", "s", "signal")
210209
def connect(self, signal, func):
211210
"""Register *func* to be called when signal *signal* is generated."""
212211
if signal == "units finalize":
Collapse file

‎lib/matplotlib/contour.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/contour.py
-25Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -248,31 +248,6 @@ def too_close(self, x, y, lw):
248248
return any((x - loc[0]) ** 2 + (y - loc[1]) ** 2 < thresh
249249
for loc in self.labelXYs)
250250

251-
@_api.deprecated("3.4")
252-
def get_label_coords(self, distances, XX, YY, ysize, lw):
253-
"""
254-
Return x, y, and the index of a label location.
255-
256-
Labels are plotted at a location with the smallest
257-
deviation of the contour from a straight line
258-
unless there is another label nearby, in which case
259-
the next best place on the contour is picked up.
260-
If all such candidates are rejected, the beginning
261-
of the contour is chosen.
262-
"""
263-
hysize = int(ysize / 2)
264-
adist = np.argsort(distances)
265-
266-
for ind in adist:
267-
x, y = XX[ind][hysize], YY[ind][hysize]
268-
if self.too_close(x, y, lw):
269-
continue
270-
return x, y, ind
271-
272-
ind = adist[0]
273-
x, y = XX[ind][hysize], YY[ind][hysize]
274-
return x, y, ind
275-
276251
def _get_nth_label_width(self, nth):
277252
"""Return the width of the *nth* label, in pixels."""
278253
fig = self.axes.figure
Collapse file

‎lib/matplotlib/gridspec.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/gridspec.py
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,7 @@ def is_first_col(self):
664664
def is_last_col(self):
665665
return self.colspan.stop == self.get_gridspec().ncols
666666

667-
@_api.delete_parameter("3.4", "return_all")
668-
def get_position(self, figure, return_all=False):
667+
def get_position(self, figure):
669668
"""
670669
Update the subplot position from ``figure.subplotpars``.
671670
"""
@@ -679,12 +678,7 @@ def get_position(self, figure, return_all=False):
679678
fig_top = fig_tops[rows].max()
680679
fig_left = fig_lefts[cols].min()
681680
fig_right = fig_rights[cols].max()
682-
figbox = Bbox.from_extents(fig_left, fig_bottom, fig_right, fig_top)
683-
684-
if return_all:
685-
return figbox, rows[0], cols[0], nrows, ncols
686-
else:
687-
return figbox
681+
return Bbox.from_extents(fig_left, fig_bottom, fig_right, fig_top)
688682

689683
def get_topmost_subplotspec(self):
690684
"""
Collapse file

‎lib/matplotlib/image.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/image.py
+7-23Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,29 +1526,13 @@ def imread(fname, format=None):
15261526
ext = format
15271527
img_open = (
15281528
PIL.PngImagePlugin.PngImageFile if ext == 'png' else PIL.Image.open)
1529-
if isinstance(fname, str):
1530-
parsed = parse.urlparse(fname)
1531-
if len(parsed.scheme) > 1: # Pillow doesn't handle URLs directly.
1532-
_api.warn_deprecated(
1533-
"3.4", message="Directly reading images from URLs is "
1534-
"deprecated since %(since)s and will no longer be supported "
1535-
"%(removal)s. Please open the URL for reading and pass the "
1536-
"result to Pillow, e.g. with "
1537-
"``np.array(PIL.Image.open(urllib.request.urlopen(url)))``.")
1538-
# hide imports to speed initial import on systems with slow linkers
1539-
from urllib import request
1540-
ssl_ctx = mpl._get_ssl_context()
1541-
if ssl_ctx is None:
1542-
_log.debug(
1543-
"Could not get certifi ssl context, https may not work."
1544-
)
1545-
with request.urlopen(fname, context=ssl_ctx) as response:
1546-
import io
1547-
try:
1548-
response.seek(0)
1549-
except (AttributeError, io.UnsupportedOperation):
1550-
response = io.BytesIO(response.read())
1551-
return imread(response, format=ext)
1529+
if isinstance(fname, str) and len(parse.urlparse(fname).scheme) > 1:
1530+
# Pillow doesn't handle URLs directly.
1531+
raise ValueError(
1532+
"Please open the URL for reading and pass the "
1533+
"result to Pillow, e.g. with "
1534+
"``np.array(PIL.Image.open(urllib.request.urlopen(url)))``."
1535+
)
15521536
with img_open(fname) as image:
15531537
return (_pil_png_to_float_array(image)
15541538
if isinstance(image, PIL.PngImagePlugin.PngImageFile) else
Collapse file

‎lib/matplotlib/offsetbox.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/offsetbox.py
-26Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -688,11 +688,9 @@ class TextArea(OffsetBox):
688688
child text.
689689
"""
690690

691-
@_api.delete_parameter("3.4", "minimumdescent")
692691
def __init__(self, s,
693692
textprops=None,
694693
multilinebaseline=False,
695-
minimumdescent=True,
696694
):
697695
"""
698696
Parameters
@@ -705,9 +703,6 @@ def __init__(self, s,
705703
multilinebaseline : bool, default: False
706704
Whether the baseline for multiline text is adjusted so that it
707705
is (approximately) center-aligned with single-line text.
708-
minimumdescent : bool, default: True
709-
If `True`, the box has a minimum descent of "p". This is now
710-
effectively always True.
711706
"""
712707
if textprops is None:
713708
textprops = {}
@@ -719,7 +714,6 @@ def __init__(self, s,
719714
self._text.set_transform(self.offset_transform +
720715
self._baseline_transform)
721716
self._multilinebaseline = multilinebaseline
722-
self._minimumdescent = minimumdescent
723717

724718
def set_text(self, s):
725719
"""Set the text of this area as a string."""
@@ -748,26 +742,6 @@ def get_multilinebaseline(self):
748742
"""
749743
return self._multilinebaseline
750744

751-
@_api.deprecated("3.4")
752-
def set_minimumdescent(self, t):
753-
"""
754-
Set minimumdescent.
755-
756-
If True, extent of the single line text is adjusted so that
757-
its descent is at least the one of the glyph "p".
758-
"""
759-
# The current implementation of Text._get_layout always behaves as if
760-
# this is True.
761-
self._minimumdescent = t
762-
self.stale = True
763-
764-
@_api.deprecated("3.4")
765-
def get_minimumdescent(self):
766-
"""
767-
Get minimumdescent.
768-
"""
769-
return self._minimumdescent
770-
771745
def set_transform(self, t):
772746
"""
773747
set_transform is ignored.
Collapse file

‎lib/matplotlib/sphinxext/plot_directive.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/sphinxext/plot_directive.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@
162162
from matplotlib import _api, _pylab_helpers, cbook
163163

164164
matplotlib.use("agg")
165-
align = _api.deprecated(
166-
"3.4", alternative="docutils.parsers.rst.directives.images.Image.align")(
167-
Image.align)
168165

169166
__version__ = 2
170167

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.