Skip to content

Commit b6a5c7b

Browse files
committed
Remove API deprecated in 3.1
1 parent aa18f5a commit b6a5c7b

22 files changed

+71
-852
lines changed

doc/api/next_api_changes/removals.rst

+68
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,70 @@
11
Removals
22
--------
3+
The following deprecated APIs have been removed:
4+
5+
Classes and methods
6+
~~~~~~~~~~~~~~~~~~~
7+
- ``backend_bases.RendererBase.strip_math()``
8+
(use ``cbook.strip_math()`` instead)
9+
10+
- ``backend_wx.debug_on_error()`` (no replacement)
11+
- ``backend_wx.raise_msg_to_str()`` (no replacement)
12+
- ``backend_wx.fake_stderr`` (no replacement)
13+
- ``backend_wx.MenuButtonWx`` (no replacement)
14+
- ``backend_wx.PrintoutWx`` (no replacement)
15+
- ``_backend_tk.NavigationToolbar2Tk.set_active()`` (no replacement)
16+
17+
- ``backend_ps.PsBackendHelper.gs_exe`` property (no replacement)
18+
- ``backend_ps.PsBackendHelper.gs_version`` property (no replacement)
19+
- ``backend_ps.PsBackendHelper.supports_ps2write`` property (no replacement)
20+
- ``backend_ps.RendererPS.afmfontd`` property (no replacement)
21+
- ``backend_ps.GraphicsContextPS.shouldstroke`` property (no replacement)
22+
23+
- ``backend_gtk3.FileChooserDialog`` (no replacement)
24+
- ``backend_gtk3.SaveFigureGTK3.get_filechooser()`` (no replacement)
25+
- ``backend_gtk3.NavigationToolbar2GTK3.get_filechooser()`` (no replacement)
26+
27+
- ``backend_gtk3cairo.FigureManagerGTK3Cairo``
28+
(use ``backend_gtk3.FigureManagerGTK3`` instead)
29+
30+
- ``backend_pdf.RendererPdf.afm_font_cache`` property (no replacement)
31+
32+
- ``backend_pgf.LatexManagerFactory`` (no replacement)
33+
34+
- ``backend_qt5.NavigationToolbar2QT.buttons`` property (no replacement)
35+
- ``backend_qt5.NavigationToolbar2QT.adj_window`` property (no replacement)
36+
37+
- ``matplotlib.checkdep_dvipng`` (no replacement)
38+
- ``matplotlib.checkdep_ghostscript`` (no replacement)
39+
- ``matplotlib.checkdep_pdftops`` (no replacement)
40+
- ``matplotlib.checkdep_inkscape`` (no replacement)
41+
- ``matplotlib.get_py2exe_datafiles`` (no replacement)
42+
- ``matplotlib.tk_window_focus`` (use ``rcParams['tk.window_focus']`` instead)
43+
44+
- ``pyplot.plotfile()`` (Instead, load the data using
45+
`pandas.read_csv` or `numpy.load_txt` or similar and use regular pyplot
46+
functions to plot the loaded data.)
47+
- ``rcsetup.validate_qt4()`` (no replacement)
48+
- ``rcsetup.validate_qt5()`` (no replacement)
49+
- ``rcsetup.validate_verbose()`` (no replacement)
50+
- ``rcsetup.ValidateInterval`` (no replacement)
51+
52+
- ``sphinxext.plot_directive.plot_directive()``
53+
(use the class ``PlotDirective`` instead)
54+
55+
- ``Axes.aname`` property (no replacement)
56+
- ``Axis.iter_ticks`` (no replacement)
57+
58+
- ``image.BboxImage.interp_at_native`` property (no replacement)
59+
- ``lines.Line2D.verticalOffset`` property (no replacement)
60+
- ``bezier.find_r_to_boundary_of_closedpath()`` (no relacement)
61+
62+
- ``quiver.Quiver.color()`` (use ``Quiver._getfacecolor()`` instead)
63+
- ``quiver.Quiver.keyvec`` property (no replacement)
64+
- ``quiver.Quiver.keytext`` property (no replacement)
65+
66+
- ``colorbar.ColorbarBase.get_cmap`` (use ``ScalarMappable.get_cmap`` instead)
67+
- ``colorbar.ColorbarBase.set_cmap`` (use ``ScalarMappable.set_cmap`` instead)
68+
- ``colorbar.ColorbarBase.get_clim`` (use ``ScalarMappable.get_clim`` instead)
69+
- ``colorbar.ColorbarBase.set_clim`` (use ``ScalarMappable.set_clim`` instead)
70+
- ``colorbar.ColorbarBase.set_norm`` (use ``ScalarMappable.set_norm`` instead)

lib/matplotlib/__init__.py

-98
Original file line numberDiff line numberDiff line change
@@ -395,81 +395,6 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
395395
raise ValueError("Unknown executable: {!r}".format(name))
396396

397397

398-
@cbook.deprecated("3.1")
399-
def checkdep_dvipng():
400-
try:
401-
s = subprocess.Popen(['dvipng', '-version'],
402-
stdout=subprocess.PIPE,
403-
stderr=subprocess.PIPE)
404-
stdout, stderr = s.communicate()
405-
line = stdout.decode('ascii').split('\n')[1]
406-
v = line.split()[-1]
407-
return v
408-
except (IndexError, ValueError, OSError):
409-
return None
410-
411-
412-
@cbook.deprecated("3.1")
413-
def checkdep_ghostscript():
414-
if checkdep_ghostscript.executable is None:
415-
if sys.platform == 'win32':
416-
# mgs is the name in miktex
417-
gs_execs = ['gswin32c', 'gswin64c', 'mgs', 'gs']
418-
else:
419-
gs_execs = ['gs']
420-
for gs_exec in gs_execs:
421-
try:
422-
s = subprocess.Popen(
423-
[gs_exec, '--version'], stdout=subprocess.PIPE,
424-
stderr=subprocess.PIPE)
425-
stdout, stderr = s.communicate()
426-
if s.returncode == 0:
427-
v = stdout[:-1].decode('ascii')
428-
if compare_versions(v, '9.0'):
429-
checkdep_ghostscript.executable = gs_exec
430-
checkdep_ghostscript.version = v
431-
except (IndexError, ValueError, OSError):
432-
pass
433-
return checkdep_ghostscript.executable, checkdep_ghostscript.version
434-
checkdep_ghostscript.executable = None
435-
checkdep_ghostscript.version = None
436-
437-
438-
@cbook.deprecated("3.1")
439-
def checkdep_pdftops():
440-
try:
441-
s = subprocess.Popen(['pdftops', '-v'], stdout=subprocess.PIPE,
442-
stderr=subprocess.PIPE)
443-
stdout, stderr = s.communicate()
444-
lines = stderr.decode('ascii').split('\n')
445-
for line in lines:
446-
if 'version' in line:
447-
v = line.split()[-1]
448-
return v
449-
except (IndexError, ValueError, UnboundLocalError, OSError):
450-
return None
451-
452-
453-
@cbook.deprecated("3.1")
454-
def checkdep_inkscape():
455-
if checkdep_inkscape.version is None:
456-
try:
457-
s = subprocess.Popen(['inkscape', '-V'],
458-
stdout=subprocess.PIPE,
459-
stderr=subprocess.PIPE)
460-
stdout, stderr = s.communicate()
461-
lines = stdout.decode('ascii').split('\n')
462-
for line in lines:
463-
if 'Inkscape' in line:
464-
v = line.split()[1]
465-
break
466-
checkdep_inkscape.version = v
467-
except (IndexError, ValueError, UnboundLocalError, OSError):
468-
pass
469-
return checkdep_inkscape.version
470-
checkdep_inkscape.version = None
471-
472-
473398
@cbook.deprecated("3.2")
474399
def checkdep_ps_distiller(s):
475400
if not s:
@@ -648,16 +573,6 @@ def get_data_path():
648573
return defaultParams['datapath'][0]
649574

650575

651-
@cbook.deprecated("3.1")
652-
def get_py2exe_datafiles():
653-
data_path = Path(get_data_path())
654-
d = {}
655-
for path in filter(Path.is_file, data_path.glob("**/*")):
656-
(d.setdefault(str(path.parent.relative_to(data_path.parent)), [])
657-
.append(str(path)))
658-
return list(d.items())
659-
660-
661576
def matplotlib_fname():
662577
"""
663578
Get the location of the config file.
@@ -1273,19 +1188,6 @@ def is_interactive():
12731188
return rcParams['interactive']
12741189

12751190

1276-
@cbook.deprecated("3.1", alternative="rcParams['tk.window_focus']")
1277-
def tk_window_focus():
1278-
"""
1279-
Return true if focus maintenance under TkAgg on win32 is on.
1280-
1281-
This currently works only for python.exe and IPython.exe.
1282-
Both IDLE and Pythonwin.exe fail badly when tk_window_focus is on.
1283-
"""
1284-
if rcParams['backend'] != 'TkAgg':
1285-
return False
1286-
return rcParams['tk.window_focus']
1287-
1288-
12891191
default_test_modules = [
12901192
'matplotlib.tests',
12911193
'mpl_toolkits.tests',

lib/matplotlib/artist.py

-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ class Artist:
6060
6161
Typically, all visible elements in a figure are subclasses of Artist.
6262
"""
63-
@cbook.deprecated("3.1")
64-
@property
65-
def aname(self):
66-
return 'Artist'
6763

6864
zorder = 0
6965
# order of precedence when bulk setting/updating properties

lib/matplotlib/axes/_axes.py

-5
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ class Axes(_AxesBase):
9191
"""
9292
### Labelling, legend and texts
9393

94-
@cbook.deprecated("3.1")
95-
@property
96-
def aname(self):
97-
return 'Axes'
98-
9994
def get_title(self, loc="center"):
10095
"""
10196
Get an axes title.

lib/matplotlib/axis.py

-14
Original file line numberDiff line numberDiff line change
@@ -981,20 +981,6 @@ def _set_artist_props(self, a):
981981
return
982982
a.set_figure(self.figure)
983983

984-
@cbook.deprecated("3.1")
985-
def iter_ticks(self):
986-
"""
987-
Yield ``(Tick, location, label)`` tuples for major and minor ticks.
988-
"""
989-
major_locs = self.get_majorticklocs()
990-
major_labels = self.major.formatter.format_ticks(major_locs)
991-
major_ticks = self.get_major_ticks(len(major_locs))
992-
yield from zip(major_ticks, major_locs, major_labels)
993-
minor_locs = self.get_minorticklocs()
994-
minor_labels = self.minor.formatter.format_ticks(minor_locs)
995-
minor_ticks = self.get_minor_ticks(len(minor_locs))
996-
yield from zip(minor_ticks, minor_locs, minor_labels)
997-
998984
def get_ticklabel_extents(self, renderer):
999985
"""
1000986
Get the extents of the tick labels on either side

lib/matplotlib/backend_bases.py

-4
Original file line numberDiff line numberDiff line change
@@ -670,10 +670,6 @@ def points_to_pixels(self, points):
670670
"""
671671
return points
672672

673-
@cbook.deprecated("3.1", alternative="cbook.strip_math")
674-
def strip_math(self, s):
675-
return cbook.strip_math(s)
676-
677673
def start_rasterizing(self):
678674
"""
679675
Switch to the raster renderer.

lib/matplotlib/backends/_backend_tk.py

-5
Original file line numberDiff line numberDiff line change
@@ -639,11 +639,6 @@ def save_figure(self, *args):
639639
except Exception as e:
640640
tkinter.messagebox.showerror("Error saving file", str(e))
641641

642-
@cbook.deprecated("3.1")
643-
def set_active(self, ind):
644-
self._ind = ind
645-
self._active = [self._axes[i] for i in self._ind]
646-
647642
def update(self):
648643
self._axes = self.canvas.figure.axes
649644
with _restore_foreground_window_at_end():

lib/matplotlib/backends/backend_gtk3.py

-96
Original file line numberDiff line numberDiff line change
@@ -539,17 +539,6 @@ def zoom(self, *args):
539539
super().zoom(*args)
540540
self._update_buttons_checked()
541541

542-
@cbook.deprecated("3.1")
543-
def get_filechooser(self):
544-
fc = FileChooserDialog(
545-
title='Save the figure',
546-
parent=self.win,
547-
path=os.path.expanduser(rcParams['savefig.directory']),
548-
filetypes=self.canvas.get_supported_filetypes(),
549-
default_filetype=self.canvas.get_default_filetype())
550-
fc.set_current_name(self.canvas.get_default_filename())
551-
return fc
552-
553542
def save_figure(self, *args):
554543
dialog = Gtk.FileChooserDialog(
555544
title="Save the figure",
@@ -631,79 +620,6 @@ def set_history_buttons(self):
631620
self._gtk_ids['Forward'].set_sensitive(can_forward)
632621

633622

634-
@cbook.deprecated("3.1")
635-
class FileChooserDialog(Gtk.FileChooserDialog):
636-
"""GTK+ file selector which remembers the last file/directory
637-
selected and presents the user with a menu of supported image formats
638-
"""
639-
def __init__(self,
640-
title='Save file',
641-
parent=None,
642-
action=Gtk.FileChooserAction.SAVE,
643-
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
644-
Gtk.STOCK_SAVE, Gtk.ResponseType.OK),
645-
path=None,
646-
filetypes=[],
647-
default_filetype=None,
648-
):
649-
super().__init__(title, parent, action, buttons)
650-
self.set_default_response(Gtk.ResponseType.OK)
651-
self.set_do_overwrite_confirmation(True)
652-
653-
if not path:
654-
path = os.getcwd()
655-
656-
# create an extra widget to list supported image formats
657-
self.set_current_folder(path)
658-
self.set_current_name('image.' + default_filetype)
659-
660-
hbox = Gtk.Box(spacing=10)
661-
hbox.pack_start(Gtk.Label(label="File Format:"), False, False, 0)
662-
663-
liststore = Gtk.ListStore(GObject.TYPE_STRING)
664-
cbox = Gtk.ComboBox()
665-
cbox.set_model(liststore)
666-
cell = Gtk.CellRendererText()
667-
cbox.pack_start(cell, True)
668-
cbox.add_attribute(cell, 'text', 0)
669-
hbox.pack_start(cbox, False, False, 0)
670-
671-
self.filetypes = filetypes
672-
sorted_filetypes = sorted(filetypes.items())
673-
default = 0
674-
for i, (ext, name) in enumerate(sorted_filetypes):
675-
liststore.append(["%s (*.%s)" % (name, ext)])
676-
if ext == default_filetype:
677-
default = i
678-
cbox.set_active(default)
679-
self.ext = default_filetype
680-
681-
def cb_cbox_changed(cbox, data=None):
682-
"""File extension changed"""
683-
head, filename = os.path.split(self.get_filename())
684-
root, ext = os.path.splitext(filename)
685-
ext = ext[1:]
686-
new_ext = sorted_filetypes[cbox.get_active()][0]
687-
self.ext = new_ext
688-
689-
if ext in self.filetypes:
690-
filename = root + '.' + new_ext
691-
elif ext == '':
692-
filename = filename.rstrip('.') + '.' + new_ext
693-
694-
self.set_current_name(filename)
695-
cbox.connect("changed", cb_cbox_changed)
696-
697-
hbox.show_all()
698-
self.set_extra_widget(hbox)
699-
700-
def get_filename_from_user(self):
701-
if self.run() == int(Gtk.ResponseType.OK):
702-
return self.get_filename(), self.ext
703-
else:
704-
return None, self.ext
705-
706-
707623
class ToolbarGTK3(ToolContainerBase, Gtk.Box):
708624
_icon_extension = '.png'
709625

@@ -800,18 +716,6 @@ def draw_rubberband(self, x0, y0, x1, y1):
800716

801717

802718
class SaveFigureGTK3(backend_tools.SaveFigureBase):
803-
804-
@cbook.deprecated("3.1")
805-
def get_filechooser(self):
806-
fc = FileChooserDialog(
807-
title='Save the figure',
808-
parent=self.figure.canvas.manager.window,
809-
path=os.path.expanduser(rcParams['savefig.directory']),
810-
filetypes=self.figure.canvas.get_supported_filetypes(),
811-
default_filetype=self.figure.canvas.get_default_filetype())
812-
fc.set_current_name(self.figure.canvas.get_default_filename())
813-
return fc
814-
815719
def trigger(self, *args, **kwargs):
816720

817721
class PseudoToolbar:

lib/matplotlib/backends/backend_gtk3cairo.py

-5
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ def on_draw_event(self, widget, ctx):
3838
self._render_figure(allocation.width, allocation.height)
3939

4040

41-
@cbook.deprecated("3.1", alternative="backend_gtk3.FigureManagerGTK3")
42-
class FigureManagerGTK3Cairo(backend_gtk3.FigureManagerGTK3):
43-
pass
44-
45-
4641
@_BackendGTK3.export
4742
class _BackendGTK3Cairo(_BackendGTK3):
4843
FigureCanvas = FigureCanvasGTK3Cairo

lib/matplotlib/backends/backend_pdf.py

-4
Original file line numberDiff line numberDiff line change
@@ -1668,10 +1668,6 @@ def writeTrailer(self):
16681668

16691669

16701670
class RendererPdf(_backend_pdf_ps.RendererPDFPSBase):
1671-
@property
1672-
@cbook.deprecated("3.1")
1673-
def afm_font_cache(self, _cache=cbook.maxdict(50)):
1674-
return _cache
16751671

16761672
_afm_font_dir = cbook._get_data_path("fonts/pdfcorefonts")
16771673
_use_afm_rc_name = "pdf.use14corefonts"

0 commit comments

Comments
 (0)