diff --git a/doc/api/next_api_changes/removals.rst b/doc/api/next_api_changes/removals.rst index b00f77abef85..a7df81f97a5b 100644 --- a/doc/api/next_api_changes/removals.rst +++ b/doc/api/next_api_changes/removals.rst @@ -1,2 +1,70 @@ Removals -------- +The following deprecated APIs have been removed: + +Classes and methods +~~~~~~~~~~~~~~~~~~~ +- ``backend_bases.RendererBase.strip_math()`` + (use ``cbook.strip_math()`` instead) + +- ``backend_wx.debug_on_error()`` (no replacement) +- ``backend_wx.raise_msg_to_str()`` (no replacement) +- ``backend_wx.fake_stderr`` (no replacement) +- ``backend_wx.MenuButtonWx`` (no replacement) +- ``backend_wx.PrintoutWx`` (no replacement) +- ``_backend_tk.NavigationToolbar2Tk.set_active()`` (no replacement) + +- ``backend_ps.PsBackendHelper.gs_exe`` property (no replacement) +- ``backend_ps.PsBackendHelper.gs_version`` property (no replacement) +- ``backend_ps.PsBackendHelper.supports_ps2write`` property (no replacement) +- ``backend_ps.RendererPS.afmfontd`` property (no replacement) +- ``backend_ps.GraphicsContextPS.shouldstroke`` property (no replacement) + +- ``backend_gtk3.FileChooserDialog`` (no replacement) +- ``backend_gtk3.SaveFigureGTK3.get_filechooser()`` (no replacement) +- ``backend_gtk3.NavigationToolbar2GTK3.get_filechooser()`` (no replacement) + +- ``backend_gtk3cairo.FigureManagerGTK3Cairo`` + (use ``backend_gtk3.FigureManagerGTK3`` instead) + +- ``backend_pdf.RendererPdf.afm_font_cache`` property (no replacement) + +- ``backend_pgf.LatexManagerFactory`` (no replacement) + +- ``backend_qt5.NavigationToolbar2QT.buttons`` property (no replacement) +- ``backend_qt5.NavigationToolbar2QT.adj_window`` property (no replacement) + +- ``matplotlib.checkdep_dvipng`` (no replacement) +- ``matplotlib.checkdep_ghostscript`` (no replacement) +- ``matplotlib.checkdep_pdftops`` (no replacement) +- ``matplotlib.checkdep_inkscape`` (no replacement) +- ``matplotlib.get_py2exe_datafiles`` (no replacement) +- ``matplotlib.tk_window_focus`` (use ``rcParams['tk.window_focus']`` instead) + +- ``pyplot.plotfile()`` (Instead, load the data using + `pandas.read_csv` or `numpy.loadtxt` or similar and use regular pyplot + functions to plot the loaded data.) +- ``rcsetup.validate_qt4()`` (no replacement) +- ``rcsetup.validate_qt5()`` (no replacement) +- ``rcsetup.validate_verbose()`` (no replacement) +- ``rcsetup.ValidateInterval`` (no replacement) + +- ``sphinxext.plot_directive.plot_directive()`` + (use the class ``PlotDirective`` instead) + +- ``Artist.aname`` property (no replacement) +- ``Axis.iter_ticks`` (no replacement) + +- ``image.BboxImage.interp_at_native`` property (no replacement) +- ``lines.Line2D.verticalOffset`` property (no replacement) +- ``bezier.find_r_to_boundary_of_closedpath()`` (no relacement) + +- ``quiver.Quiver.color()`` (use ``Quiver.get_facecolor()`` instead) +- ``quiver.Quiver.keyvec`` property (no replacement) +- ``quiver.Quiver.keytext`` property (no replacement) + +- ``colorbar.ColorbarBase.get_cmap`` (use ``ScalarMappable.get_cmap`` instead) +- ``colorbar.ColorbarBase.set_cmap`` (use ``ScalarMappable.set_cmap`` instead) +- ``colorbar.ColorbarBase.get_clim`` (use ``ScalarMappable.get_clim`` instead) +- ``colorbar.ColorbarBase.set_clim`` (use ``ScalarMappable.set_clim`` instead) +- ``colorbar.ColorbarBase.set_norm`` (use ``ScalarMappable.set_norm`` instead) diff --git a/doc/api/prev_api_changes/api_changes_1.3.x.rst b/doc/api/prev_api_changes/api_changes_1.3.x.rst index 42ebff10d6e3..5b596d83b5e2 100644 --- a/doc/api/prev_api_changes/api_changes_1.3.x.rst +++ b/doc/api/prev_api_changes/api_changes_1.3.x.rst @@ -213,6 +213,6 @@ Configuration and rcParams other rcParams. * Removed call of :meth:`~matplotlib.axes.Axes.grid` in - :meth:`~matplotlib.pyplot.plotfile`. To draw the axes grid, set the + ``matplotlib.pyplot.plotfile``. To draw the axes grid, set the ``axes.grid`` rcParam to *True*, or explicitly call :meth:`~matplotlib.axes.Axes.grid`. diff --git a/doc/api/prev_api_changes/api_changes_3.1.0.rst b/doc/api/prev_api_changes/api_changes_3.1.0.rst index 641ada945f93..1d823e7ec7b8 100644 --- a/doc/api/prev_api_changes/api_changes_3.1.0.rst +++ b/doc/api/prev_api_changes/api_changes_3.1.0.rst @@ -820,7 +820,7 @@ suggest that custom backends let their ``GraphicsContext`` class inherit from `.GraphicsContextBase`, to at least provide stubs for all required methods. -- `.spine.Spine.is_frame_like` +- ``spine.Spine.is_frame_like`` This has not been used in the codebase since its addition in 2009. @@ -829,28 +829,28 @@ This has not been used in the codebase since its addition in 2009. This has never been used internally, there is no equivalent method exists on the 2D Axis classes, and despite the similar name, it has a completely different behavior from the 2D Axis' `axis.Axis.get_ticks_position` method. -- `.backend_pgf.LatexManagerFactory` +- ``.backend_pgf.LatexManagerFactory`` -- `.mpl_toolkits.axisartist.axislines.SimpleChainedObjects` -- `.mpl_toolkits.Axes.AxisDict` +- ``mpl_toolkits.axisartist.axislines.SimpleChainedObjects`` +- ``mpl_toolkits.Axes.AxisDict`` Internal Helper Functions ~~~~~~~~~~~~~~~~~~~~~~~~~ -- `.checkdep_dvipng` -- `.checkdep_ghostscript` -- `.checkdep_pdftops` -- `.checkdep_inkscape` +- ``checkdep_dvipng`` +- ``checkdep_ghostscript`` +- ``checkdep_pdftops`` +- ``checkdep_inkscape`` -- `.ticker.decade_up` -- `.ticker.decade_down` +- ``ticker.decade_up`` +- ``ticker.decade_down`` -- `.cbook.dedent` -- `.docstring.Appender` -- `.docstring.dedent` -- `.docstring.copy_dedent` +- ``cbook.dedent`` +- ``docstring.Appender`` +- ``docstring.dedent`` +- ``docstring.copy_dedent`` Use the standard library's docstring manipulation tools instead, such as `inspect.cleandoc` and `inspect.getdoc`. @@ -875,7 +875,7 @@ future version. - `.cbook.is_hashable` Use ``isinstance(..., collections.abc.Hashable)`` instead. -- The `.backend_bases.RendererBase.strip_math`. Use +- The ``.backend_bases.RendererBase.strip_math``. Use `.cbook.strip_math` instead. Multiple internal functions that were exposed as part of the public API @@ -910,19 +910,19 @@ If your project relies on these functions, consider vendoring them. Font Handling ~~~~~~~~~~~~~ -- `.backend_pdf.RendererPdf.afm_font_cache` -- `.backend_ps.RendererPS.afmfontd` -- `.font_manager.OSXInstalledFonts` +- ``backend_pdf.RendererPdf.afm_font_cache`` +- ``backend_ps.RendererPS.afmfontd`` +- ``font_manager.OSXInstalledFonts`` - `.TextToPath.glyph_to_path` (Instead call ``font.get_path()`` and manually transform the path.) Date related functions ~~~~~~~~~~~~~~~~~~~~~~ -- `.dates.seconds()` -- `.dates.minutes()` -- `.dates.hours()` -- `.dates.weeks()` +- ``dates.seconds()`` +- ``dates.minutes()`` +- ``dates.hours()`` +- ``dates.weeks()`` - `.dates.strpdate2num` - `.dates.bytespdate2num` @@ -983,7 +983,7 @@ available on PyPI. Install that module separately if you need it. .. _formlayout: https://pypi.org/project/formlayout/ -- `.GraphicsContextPS.shouldstroke` +- ``GraphicsContextPS.shouldstroke`` Transforms / scales @@ -1038,11 +1038,11 @@ Text Unused attributes ~~~~~~~~~~~~~~~~~ -- `.NavigationToolbar2QT.buttons` -- `.Line2D.verticalOffset` -- `.Quiver.keytext` -- `.Quiver.keyvec` -- `.SpanSelector.buttonDown` +- ``NavigationToolbar2QT.buttons`` +- ``Line2D.verticalOffset`` +- ``Quiver.keytext`` +- ``Quiver.keyvec`` +- ``SpanSelector.buttonDown`` These are unused and never updated. diff --git a/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst b/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst index c61c9cca3b03..c4019b737b91 100644 --- a/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst +++ b/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst @@ -10,10 +10,9 @@ if so desired). plotfile ~~~~~~~~ -`.pyplot.plotfile` is deprecated in favor of separately loading and plotting -the data. See :doc:`/gallery/misc/plotfile_demo_sgskip` for various ways to -use pandas or NumPy to load data, and pandas or matplotlib to plot the -resulting data. +``.pyplot.plotfile`` is deprecated in favor of separately loading and plotting +the data. Use pandas or NumPy to load data, and pandas or matplotlib to plot +the resulting data. axes and axis ~~~~~~~~~~~~~ diff --git a/examples/misc/plotfile_demo_sgskip.py b/examples/misc/plotfile_demo_sgskip.py deleted file mode 100644 index 29bc0c1fac31..000000000000 --- a/examples/misc/plotfile_demo_sgskip.py +++ /dev/null @@ -1,170 +0,0 @@ -""" -========================= -Plotting data from a file -========================= - -Plotting data from a file is actually a two-step process. - -1. Interpreting the file and loading the data. -2. Creating the actual plot. - -`.pyplot.plotfile` tried to do both at once. But each of the steps has so many -possible variations and parameters that it does not make sense to squeeze both -into a single function. Therefore, `.pyplot.plotfile` has been deprecated. - -The recommended way of plotting data from a file is therefore to use dedicated -functions such as `numpy.loadtxt` or `pandas.read_csv` to read the data. These -are more powerful and faster. Then plot the obtained data using matplotlib. - -Note that `pandas.DataFrame.plot` is a convenient wrapper around Matplotlib -to create simple plots. -""" - -import matplotlib.pyplot as plt -import matplotlib.cbook as cbook - -import numpy as np -import pandas as pd - -############################################################################### -# Using pandas -# ============ -# -# Subsequent are a few examples of how to replace `~.pyplot.plotfile` with -# `pandas`. All examples need the the `pandas.read_csv` call first. Note that -# you can use the filename directly as a parameter:: -# -# msft = pd.read_csv('msft.csv') -# -# The following slightly more involved `pandas.read_csv` call is only to make -# automatic rendering of the example work: - -fname = cbook.get_sample_data('msft.csv', asfileobj=False) -with cbook.get_sample_data('msft.csv') as file: - msft = pd.read_csv(file) - -############################################################################### -# When working with dates, additionally call -# `pandas.plotting.register_matplotlib_converters` and use the ``parse_dates`` -# argument of `pandas.read_csv`:: - -pd.plotting.register_matplotlib_converters() - -with cbook.get_sample_data('msft.csv') as file: - msft = pd.read_csv(file, parse_dates=['Date']) - - -############################################################################### -# Use indices -# ----------- - -# Deprecated: -plt.plotfile(fname, (0, 5, 6)) - -# Use instead: -msft.plot(0, [5, 6], subplots=True) - -############################################################################### -# Use names -# --------- - -# Deprecated: -plt.plotfile(fname, ('date', 'volume', 'adj_close')) - -# Use instead: -msft.plot("Date", ["Volume", "Adj. Close*"], subplots=True) - -############################################################################### -# Use semilogy for volume -# ----------------------- - -# Deprecated: -plt.plotfile(fname, ('date', 'volume', 'adj_close'), - plotfuncs={'volume': 'semilogy'}) - -# Use instead: -fig, axs = plt.subplots(2, sharex=True) -msft.plot("Date", "Volume", ax=axs[0], logy=True) -msft.plot("Date", "Adj. Close*", ax=axs[1]) - - -############################################################################### -# Use semilogy for volume (by index) -# ---------------------------------- - -# Deprecated: -plt.plotfile(fname, (0, 5, 6), plotfuncs={5: 'semilogy'}) - -# Use instead: -fig, axs = plt.subplots(2, sharex=True) -msft.plot(0, 5, ax=axs[0], logy=True) -msft.plot(0, 6, ax=axs[1]) - -############################################################################### -# Single subplot -# -------------- - -# Deprecated: -plt.plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False) - -# Use instead: -msft.plot("Date", ["Open", "High", "Low", "Close"]) - -############################################################################### -# Use bar for volume -# ------------------ - -# Deprecated: -plt.plotfile(fname, (0, 5, 6), plotfuncs={5: "bar"}) - -# Use instead: -fig, axs = plt.subplots(2, sharex=True) -axs[0].bar(msft.iloc[:, 0], msft.iloc[:, 5]) -axs[1].plot(msft.iloc[:, 0], msft.iloc[:, 6]) -fig.autofmt_xdate() - -############################################################################### -# Using numpy -# =========== - -fname2 = cbook.get_sample_data('data_x_x2_x3.csv', asfileobj=False) -with cbook.get_sample_data('data_x_x2_x3.csv') as file: - array = np.loadtxt(file) - -############################################################################### -# Labeling, if no names in csv-file -# --------------------------------- - -# Deprecated: -plt.plotfile(fname2, cols=(0, 1, 2), delimiter=' ', - names=['$x$', '$f(x)=x^2$', '$f(x)=x^3$']) - -# Use instead: -fig, axs = plt.subplots(2, sharex=True) -axs[0].plot(array[:, 0], array[:, 1]) -axs[0].set(ylabel='$f(x)=x^2$') -axs[1].plot(array[:, 0], array[:, 2]) -axs[1].set(xlabel='$x$', ylabel='$f(x)=x^3$') - -############################################################################### -# More than one file per figure -# ----------------------------- - -# For simplicity of the example we reuse the same file. -# In general they will be different. -fname3 = fname2 - -# Depreacted: -plt.plotfile(fname2, cols=(0, 1), delimiter=' ') -plt.plotfile(fname3, cols=(0, 2), delimiter=' ', - newfig=False) # use current figure -plt.xlabel(r'$x$') -plt.ylabel(r'$f(x) = x^2, x^3$') - -# Use instead: -fig, ax = plt.subplots() -ax.plot(array[:, 0], array[:, 1]) -ax.plot(array[:, 0], array[:, 2]) -ax.set(xlabel='$x$', ylabel='$f(x)=x^3$') - -plt.show() diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 623173a23d6e..54b933b6c8bd 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -395,81 +395,6 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False): raise ValueError("Unknown executable: {!r}".format(name)) -@cbook.deprecated("3.1") -def checkdep_dvipng(): - try: - s = subprocess.Popen(['dvipng', '-version'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - stdout, stderr = s.communicate() - line = stdout.decode('ascii').split('\n')[1] - v = line.split()[-1] - return v - except (IndexError, ValueError, OSError): - return None - - -@cbook.deprecated("3.1") -def checkdep_ghostscript(): - if checkdep_ghostscript.executable is None: - if sys.platform == 'win32': - # mgs is the name in miktex - gs_execs = ['gswin32c', 'gswin64c', 'mgs', 'gs'] - else: - gs_execs = ['gs'] - for gs_exec in gs_execs: - try: - s = subprocess.Popen( - [gs_exec, '--version'], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - stdout, stderr = s.communicate() - if s.returncode == 0: - v = stdout[:-1].decode('ascii') - if compare_versions(v, '9.0'): - checkdep_ghostscript.executable = gs_exec - checkdep_ghostscript.version = v - except (IndexError, ValueError, OSError): - pass - return checkdep_ghostscript.executable, checkdep_ghostscript.version -checkdep_ghostscript.executable = None -checkdep_ghostscript.version = None - - -@cbook.deprecated("3.1") -def checkdep_pdftops(): - try: - s = subprocess.Popen(['pdftops', '-v'], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - stdout, stderr = s.communicate() - lines = stderr.decode('ascii').split('\n') - for line in lines: - if 'version' in line: - v = line.split()[-1] - return v - except (IndexError, ValueError, UnboundLocalError, OSError): - return None - - -@cbook.deprecated("3.1") -def checkdep_inkscape(): - if checkdep_inkscape.version is None: - try: - s = subprocess.Popen(['inkscape', '-V'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - stdout, stderr = s.communicate() - lines = stdout.decode('ascii').split('\n') - for line in lines: - if 'Inkscape' in line: - v = line.split()[1] - break - checkdep_inkscape.version = v - except (IndexError, ValueError, UnboundLocalError, OSError): - pass - return checkdep_inkscape.version -checkdep_inkscape.version = None - - @cbook.deprecated("3.2") def checkdep_ps_distiller(s): if not s: @@ -648,16 +573,6 @@ def get_data_path(): return defaultParams['datapath'][0] -@cbook.deprecated("3.1") -def get_py2exe_datafiles(): - data_path = Path(get_data_path()) - d = {} - for path in filter(Path.is_file, data_path.glob("**/*")): - (d.setdefault(str(path.parent.relative_to(data_path.parent)), []) - .append(str(path))) - return list(d.items()) - - def matplotlib_fname(): """ Get the location of the config file. @@ -1273,19 +1188,6 @@ def is_interactive(): return rcParams['interactive'] -@cbook.deprecated("3.1", alternative="rcParams['tk.window_focus']") -def tk_window_focus(): - """ - Return true if focus maintenance under TkAgg on win32 is on. - - This currently works only for python.exe and IPython.exe. - Both IDLE and Pythonwin.exe fail badly when tk_window_focus is on. - """ - if rcParams['backend'] != 'TkAgg': - return False - return rcParams['tk.window_focus'] - - default_test_modules = [ 'matplotlib.tests', 'mpl_toolkits.tests', diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index d871b85236af..b9e55a6a572e 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -60,10 +60,6 @@ class Artist: Typically, all visible elements in a figure are subclasses of Artist. """ - @cbook.deprecated("3.1") - @property - def aname(self): - return 'Artist' zorder = 0 # order of precedence when bulk setting/updating properties diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index ac0a4cbc09f7..21de753818cd 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -91,11 +91,6 @@ class Axes(_AxesBase): """ ### Labelling, legend and texts - @cbook.deprecated("3.1") - @property - def aname(self): - return 'Axes' - def get_title(self, loc="center"): """ Get an axes title. diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index 50e7858536e3..ab02f068448f 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -981,20 +981,6 @@ def _set_artist_props(self, a): return a.set_figure(self.figure) - @cbook.deprecated("3.1") - def iter_ticks(self): - """ - Yield ``(Tick, location, label)`` tuples for major and minor ticks. - """ - major_locs = self.get_majorticklocs() - major_labels = self.major.formatter.format_ticks(major_locs) - major_ticks = self.get_major_ticks(len(major_locs)) - yield from zip(major_ticks, major_locs, major_labels) - minor_locs = self.get_minorticklocs() - minor_labels = self.minor.formatter.format_ticks(minor_locs) - minor_ticks = self.get_minor_ticks(len(minor_locs)) - yield from zip(minor_ticks, minor_locs, minor_labels) - def get_ticklabel_extents(self, renderer): """ Get the extents of the tick labels on either side diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 2b46c69e2763..fd7577808ae0 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -670,10 +670,6 @@ def points_to_pixels(self, points): """ return points - @cbook.deprecated("3.1", alternative="cbook.strip_math") - def strip_math(self, s): - return cbook.strip_math(s) - def start_rasterizing(self): """ Switch to the raster renderer. diff --git a/lib/matplotlib/backends/_backend_tk.py b/lib/matplotlib/backends/_backend_tk.py index 5354a29d956a..a1ee3266f007 100644 --- a/lib/matplotlib/backends/_backend_tk.py +++ b/lib/matplotlib/backends/_backend_tk.py @@ -639,11 +639,6 @@ def save_figure(self, *args): except Exception as e: tkinter.messagebox.showerror("Error saving file", str(e)) - @cbook.deprecated("3.1") - def set_active(self, ind): - self._ind = ind - self._active = [self._axes[i] for i in self._ind] - def update(self): self._axes = self.canvas.figure.axes with _restore_foreground_window_at_end(): diff --git a/lib/matplotlib/backends/backend_gtk3.py b/lib/matplotlib/backends/backend_gtk3.py index 95c30099df3b..707e6a2a4e5d 100644 --- a/lib/matplotlib/backends/backend_gtk3.py +++ b/lib/matplotlib/backends/backend_gtk3.py @@ -539,17 +539,6 @@ def zoom(self, *args): super().zoom(*args) self._update_buttons_checked() - @cbook.deprecated("3.1") - def get_filechooser(self): - fc = FileChooserDialog( - title='Save the figure', - parent=self.win, - path=os.path.expanduser(rcParams['savefig.directory']), - filetypes=self.canvas.get_supported_filetypes(), - default_filetype=self.canvas.get_default_filetype()) - fc.set_current_name(self.canvas.get_default_filename()) - return fc - def save_figure(self, *args): dialog = Gtk.FileChooserDialog( title="Save the figure", @@ -631,79 +620,6 @@ def set_history_buttons(self): self._gtk_ids['Forward'].set_sensitive(can_forward) -@cbook.deprecated("3.1") -class FileChooserDialog(Gtk.FileChooserDialog): - """GTK+ file selector which remembers the last file/directory - selected and presents the user with a menu of supported image formats - """ - def __init__(self, - title='Save file', - parent=None, - action=Gtk.FileChooserAction.SAVE, - buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, - Gtk.STOCK_SAVE, Gtk.ResponseType.OK), - path=None, - filetypes=[], - default_filetype=None, - ): - super().__init__(title, parent, action, buttons) - self.set_default_response(Gtk.ResponseType.OK) - self.set_do_overwrite_confirmation(True) - - if not path: - path = os.getcwd() - - # create an extra widget to list supported image formats - self.set_current_folder(path) - self.set_current_name('image.' + default_filetype) - - hbox = Gtk.Box(spacing=10) - hbox.pack_start(Gtk.Label(label="File Format:"), False, False, 0) - - liststore = Gtk.ListStore(GObject.TYPE_STRING) - cbox = Gtk.ComboBox() - cbox.set_model(liststore) - cell = Gtk.CellRendererText() - cbox.pack_start(cell, True) - cbox.add_attribute(cell, 'text', 0) - hbox.pack_start(cbox, False, False, 0) - - self.filetypes = filetypes - sorted_filetypes = sorted(filetypes.items()) - default = 0 - for i, (ext, name) in enumerate(sorted_filetypes): - liststore.append(["%s (*.%s)" % (name, ext)]) - if ext == default_filetype: - default = i - cbox.set_active(default) - self.ext = default_filetype - - def cb_cbox_changed(cbox, data=None): - """File extension changed""" - head, filename = os.path.split(self.get_filename()) - root, ext = os.path.splitext(filename) - ext = ext[1:] - new_ext = sorted_filetypes[cbox.get_active()][0] - self.ext = new_ext - - if ext in self.filetypes: - filename = root + '.' + new_ext - elif ext == '': - filename = filename.rstrip('.') + '.' + new_ext - - self.set_current_name(filename) - cbox.connect("changed", cb_cbox_changed) - - hbox.show_all() - self.set_extra_widget(hbox) - - def get_filename_from_user(self): - if self.run() == int(Gtk.ResponseType.OK): - return self.get_filename(), self.ext - else: - return None, self.ext - - class ToolbarGTK3(ToolContainerBase, Gtk.Box): _icon_extension = '.png' @@ -800,18 +716,6 @@ def draw_rubberband(self, x0, y0, x1, y1): class SaveFigureGTK3(backend_tools.SaveFigureBase): - - @cbook.deprecated("3.1") - def get_filechooser(self): - fc = FileChooserDialog( - title='Save the figure', - parent=self.figure.canvas.manager.window, - path=os.path.expanduser(rcParams['savefig.directory']), - filetypes=self.figure.canvas.get_supported_filetypes(), - default_filetype=self.figure.canvas.get_default_filetype()) - fc.set_current_name(self.figure.canvas.get_default_filename()) - return fc - def trigger(self, *args, **kwargs): class PseudoToolbar: diff --git a/lib/matplotlib/backends/backend_gtk3cairo.py b/lib/matplotlib/backends/backend_gtk3cairo.py index af1355e49d7c..587ef7abee07 100644 --- a/lib/matplotlib/backends/backend_gtk3cairo.py +++ b/lib/matplotlib/backends/backend_gtk3cairo.py @@ -38,11 +38,6 @@ def on_draw_event(self, widget, ctx): self._render_figure(allocation.width, allocation.height) -@cbook.deprecated("3.1", alternative="backend_gtk3.FigureManagerGTK3") -class FigureManagerGTK3Cairo(backend_gtk3.FigureManagerGTK3): - pass - - @_BackendGTK3.export class _BackendGTK3Cairo(_BackendGTK3): FigureCanvas = FigureCanvasGTK3Cairo diff --git a/lib/matplotlib/backends/backend_pdf.py b/lib/matplotlib/backends/backend_pdf.py index 8b2a3d4c4639..b1902845c0e7 100644 --- a/lib/matplotlib/backends/backend_pdf.py +++ b/lib/matplotlib/backends/backend_pdf.py @@ -1668,10 +1668,6 @@ def writeTrailer(self): class RendererPdf(_backend_pdf_ps.RendererPDFPSBase): - @property - @cbook.deprecated("3.1") - def afm_font_cache(self, _cache=cbook.maxdict(50)): - return _cache _afm_font_dir = cbook._get_data_path("fonts/pdfcorefonts") _use_afm_rc_name = "pdf.use14corefonts" diff --git a/lib/matplotlib/backends/backend_pgf.py b/lib/matplotlib/backends/backend_pgf.py index 60660ed1cb81..2595f80152b4 100644 --- a/lib/matplotlib/backends/backend_pgf.py +++ b/lib/matplotlib/backends/backend_pgf.py @@ -182,28 +182,6 @@ def __init__(self, message, latex_output=""): self.latex_output = latex_output -@cbook.deprecated("3.1") -class LatexManagerFactory: - previous_instance = None - - @staticmethod - def get_latex_manager(): - texcommand = rcParams["pgf.texsystem"] - latex_header = LatexManager._build_latex_header() - prev = LatexManagerFactory.previous_instance - - # Check if the previous instance of LatexManager can be reused. - if (prev and prev.latex_header == latex_header - and prev.texcommand == texcommand): - _log.debug("reusing LatexManager") - return prev - else: - _log.debug("creating LatexManager") - new_inst = LatexManager() - LatexManagerFactory.previous_instance = new_inst - return new_inst - - class LatexManager: """ The LatexManager opens an instance of the LaTeX application for diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index 33221e7ccd55..b56c252cfe1f 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -19,8 +19,7 @@ import numpy as np import matplotlib as mpl -from matplotlib import ( - cbook, _path, __version__, rcParams, checkdep_ghostscript) +from matplotlib import cbook, _path, __version__, rcParams from matplotlib import _text_layout from matplotlib.backend_bases import ( _Backend, FigureCanvasBase, FigureManagerBase, GraphicsContextBase, @@ -45,59 +44,9 @@ class PsBackendHelper: - def __init__(self): self._cached = {} - @cbook.deprecated("3.1") - @property - def gs_exe(self): - """ - executable name of ghostscript. - """ - try: - return self._cached["gs_exe"] - except KeyError: - pass - - gs_exe, gs_version = checkdep_ghostscript() - if gs_exe is None: - gs_exe = 'gs' - - self._cached["gs_exe"] = str(gs_exe) - return str(gs_exe) - - @cbook.deprecated("3.1") - @property - def gs_version(self): - """ - version of ghostscript. - """ - try: - return self._cached["gs_version"] - except KeyError: - pass - - s = subprocess.Popen( - [self.gs_exe, "--version"], stdout=subprocess.PIPE) - pipe, stderr = s.communicate() - ver = pipe.decode('ascii') - try: - gs_version = tuple(map(int, ver.strip().split("."))) - except ValueError: - # if something went wrong parsing return null version number - gs_version = (0, 0) - self._cached["gs_version"] = gs_version - return gs_version - - @cbook.deprecated("3.1") - @property - def supports_ps2write(self): - """ - True if the installed ghostscript supports ps2write device. - """ - return self.gs_version[0] >= 9 - ps_backend_helper = PsBackendHelper() @@ -189,11 +138,6 @@ class RendererPS(_backend_pdf_ps.RendererPDFPSBase): context instance that controls the colors/styles. """ - @property - @cbook.deprecated("3.1") - def afmfontd(self, _cache=cbook.maxdict(50)): - return _cache - _afm_font_dir = cbook._get_data_path("fonts/afm") _use_afm_rc_name = "ps.useafm" @@ -798,11 +742,6 @@ def get_joinstyle(self): return {'miter': 0, 'round': 1, 'bevel': 2}[ GraphicsContextBase.get_joinstyle(self)] - @cbook.deprecated("3.1") - def shouldstroke(self): - return (self.get_linewidth() > 0.0 and - (len(self.get_rgb()) <= 3 or self.get_rgb()[3] != 0.0)) - class _Orientation(Enum): portrait, landscape = range(2) diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index 5e4a0429ea20..7f5d214ac1d5 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -725,16 +725,6 @@ def _init_toolbar(self): labelAction = self.addWidget(self.locLabel) labelAction.setVisible(True) - @cbook.deprecated("3.1") - @property - def buttons(self): - return {} - - @cbook.deprecated("3.1") - @property - def adj_window(self): - return None - def edit_parameters(self): axes = self.canvas.figure.get_axes() if not axes: diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 504506392190..ef1559a61506 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -46,28 +46,6 @@ def DEBUG_MSG(string, lvl=3, o=None): print(f"{_DEBUG_lvls[lvl]}- {string} in {type(o)}") -@cbook.deprecated("3.1") -def debug_on_error(type, value, tb): - """Code due to Thomas Heller - published in Python Cookbook (O'Reilly)""" - import pdb - import traceback - traceback.print_exception(type, value, tb) - print() - pdb.pm() - - -@cbook.deprecated("3.1") -class fake_stderr: - """ - Wx does strange things with stderr, as it makes the assumption that - there is probably no console. This redirects stderr to the console, since - we know that there is one! - """ - - def write(self, msg): - print("Stderr: %s\n\r" % msg) - - # the True dots per inch on the screen; should be display dependent; see # http://groups.google.com/groups?q=screen+dpi+x11&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=7077.26e81ad5%40swift.cs.tcd.ie&rnum=5 # for some info about screen dpi @@ -90,14 +68,6 @@ def error_msg_wx(msg, parent=None): return None -@cbook.deprecated("3.1") -def raise_msg_to_str(msg): - """msg is a return arg from a raise. Join with new lines.""" - if not isinstance(msg, str): - msg = '\n'.join(map(str, msg)) - return msg - - class TimerWx(TimerBase): """ Subclass of `.TimerBase` that uses WxTimer events. @@ -1165,110 +1135,6 @@ def _set_frame_icon(frame): frame.SetIcons(bundle) -@cbook.deprecated("3.1") -class MenuButtonWx(wx.Button): - """ - wxPython does not permit a menu to be incorporated directly into a toolbar. - This class simulates the effect by associating a pop-up menu with a button - in the toolbar, and managing this as though it were a menu. - """ - - def __init__(self, parent): - - wx.Button.__init__(self, parent, wx.ID_ANY, "Axes: ", - style=wx.BU_EXACTFIT) - self._toolbar = parent - self._menu = wx.Menu() - self._axisId = [] - # First two menu items never change... - self._allId = wx.NewId() - self._invertId = wx.NewId() - self._menu.Append(self._allId, "All", "Select all axes", False) - self._menu.Append(self._invertId, "Invert", "Invert axes selected", - False) - self._menu.AppendSeparator() - - self.Bind(wx.EVT_BUTTON, self._onMenuButton, id=self.GetId()) - self.Bind(wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId) - self.Bind(wx.EVT_MENU, self._handleInvertAxesSelected, - id=self._invertId) - - def Destroy(self): - self._menu.Destroy() - self.Destroy() - - def _onMenuButton(self, evt): - """Handle menu button pressed.""" - x, y = self.GetPosition() - w, h = self.GetSize() - self.PopupMenuXY(self._menu, x, y + h - 4) - # When menu returned, indicate selection in button - evt.Skip() - - def _handleSelectAllAxes(self, evt): - """Called when the 'select all axes' menu item is selected.""" - if len(self._axisId) == 0: - return - for ax_id in self._axisId: - self._menu.Check(ax_id, True) - self._toolbar.set_active(self.getActiveAxes()) - evt.Skip() - - def _handleInvertAxesSelected(self, evt): - """Called when the invert all menu item is selected""" - if len(self._axisId) == 0: - return - for ax_id in self._axisId: - if self._menu.IsChecked(ax_id): - self._menu.Check(ax_id, False) - else: - self._menu.Check(ax_id, True) - self._toolbar.set_active(self.getActiveAxes()) - evt.Skip() - - def _onMenuItemSelected(self, evt): - """Called whenever one of the specific axis menu items is selected""" - current = self._menu.IsChecked(evt.GetId()) - if current: - new = False - else: - new = True - self._menu.Check(evt.GetId(), new) - # Lines above would be deleted based on svn tracker ID 2841525; - # not clear whether this matters or not. - self._toolbar.set_active(self.getActiveAxes()) - evt.Skip() - - def updateAxes(self, maxAxis): - """Ensures that there are entries for max_axis axes in the menu - (selected by default).""" - if maxAxis > len(self._axisId): - for i in range(len(self._axisId) + 1, maxAxis + 1): - menuId = wx.NewId() - self._axisId.append(menuId) - self._menu.Append(menuId, "Axis %d" % i, - "Select axis %d" % i, - True) - self._menu.Check(menuId, True) - self.Bind(wx.EVT_MENU, self._onMenuItemSelected, id=menuId) - elif maxAxis < len(self._axisId): - for menuId in self._axisId[maxAxis:]: - self._menu.Delete(menuId) - self._axisId = self._axisId[:maxAxis] - self._toolbar.set_active(list(range(maxAxis))) - - def getActiveAxes(self): - """Return a list of the selected axes.""" - active = [idx for idx, ax_id in enumerate(self._axisId) - if self._menu.IsChecked(ax_id)] - return active - - def updateButtonText(self, lst): - """Update the list of selected axes in the menu button.""" - self.SetLabel( - 'Axes: ' + ','.join('%d' % (e + 1) for e in lst)) - - cursord = { cursors.MOVE: wx.CURSOR_HAND, cursors.HAND: wx.CURSOR_HAND, @@ -1774,92 +1640,6 @@ def trigger(self, *args, **kwargs): backend_tools.ToolCopyToClipboard = ToolCopyToClipboardWx -# < Additions for printing support: Matt Newville - -@cbook.deprecated("3.1") -class PrintoutWx(wx.Printout): - """ - Simple wrapper around wx Printout class -- all the real work - here is scaling the matplotlib canvas bitmap to the current - printer's definition. - """ - - def __init__(self, canvas, width=5.5, margin=0.5, title='matplotlib'): - wx.Printout.__init__(self, title=title) - self.canvas = canvas - # width, in inches of output figure (approximate) - self.width = width - self.margin = margin - - def HasPage(self, page): - # current only supports 1 page print - return page == 1 - - def GetPageInfo(self): - return (1, 1, 1, 1) - - def OnPrintPage(self, page): - self.canvas.draw() - - dc = self.GetDC() - ppw, pph = self.GetPPIPrinter() # printer's pixels per in - pgw, pgh = self.GetPageSizePixels() # page size in pixels - dcw, dch = dc.GetSize() - grw, grh = self.canvas.GetSize() - - # save current figure dpi resolution and bg color, - # so that we can temporarily set them to the dpi of - # the printer, and the bg color to white - bgcolor = self.canvas.figure.get_facecolor() - fig_dpi = self.canvas.figure.dpi - - # draw the bitmap, scaled appropriately - vscale = float(ppw) / fig_dpi - - # set figure resolution,bg color for printer - self.canvas.figure.dpi = ppw - self.canvas.figure.set_facecolor('#FFFFFF') - - renderer = RendererWx(self.canvas.bitmap, self.canvas.figure.dpi) - self.canvas.figure.draw(renderer) - self.canvas.bitmap.SetWidth( - int(self.canvas.bitmap.GetWidth() * vscale)) - self.canvas.bitmap.SetHeight( - int(self.canvas.bitmap.GetHeight() * vscale)) - self.canvas.draw() - - # page may need additional scaling on preview - page_scale = 1.0 - if self.IsPreview(): - page_scale = float(dcw) / pgw - - # get margin in pixels = (margin in in) * (pixels/in) - top_margin = int(self.margin * pph * page_scale) - left_margin = int(self.margin * ppw * page_scale) - - # set scale so that width of output is self.width inches - # (assuming grw is size of graph in inches....) - user_scale = (self.width * fig_dpi * page_scale) / float(grw) - - dc.SetDeviceOrigin(left_margin, top_margin) - dc.SetUserScale(user_scale, user_scale) - - # this cute little number avoid API inconsistencies in wx - try: - dc.DrawBitmap(self.canvas.bitmap, 0, 0) - except Exception: - try: - dc.DrawBitmap(self.canvas.bitmap, (0, 0)) - except Exception: - pass - - # restore original figure resolution - self.canvas.figure.set_facecolor(bgcolor) - self.canvas.figure.dpi = fig_dpi - self.canvas.draw() - return True - - @_Backend.export class _BackendWx(_Backend): FigureCanvas = FigureCanvasWx diff --git a/lib/matplotlib/bezier.py b/lib/matplotlib/bezier.py index 9bdc5b37c54f..b6c688337e60 100644 --- a/lib/matplotlib/bezier.py +++ b/lib/matplotlib/bezier.py @@ -224,34 +224,6 @@ def split_bezier_intersecting_with_closedpath( return _left, _right -@cbook.deprecated("3.1") -@cbook._rename_parameter("3.1", "tolerence", "tolerance") -def find_r_to_boundary_of_closedpath( - inside_closedpath, xy, cos_t, sin_t, rmin=0., rmax=1., tolerance=0.01): - """ - Find a radius r (centered at *xy*) between *rmin* and *rmax* at - which it intersect with the path. - - Parameters - ---------- - inside_closedpath : callable - A function returning True if a given point (x, y) is inside the - closed path. - xy : float, float - The center of the radius. - cos_t, sin_t : float - Cosine and sine for the angle. - rmin, rmax : float - Starting parameters for the radius search. - """ - cx, cy = xy - - def _f(r): - return cos_t * r + cx, sin_t * r + cy - - find_bezier_t_intersecting_with_closedpath( - _f, inside_closedpath, t0=rmin, t1=rmax, tolerance=tolerance) - # matplotlib specific diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 537bbc46fc3f..dcf3f789fb0a 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -318,47 +318,7 @@ def tick_values(self, vmin, vmax): return ticks -class _ColorbarMappableDummy: - """ - Private class to hold deprecated ColorbarBase methods that used to be - inhereted from ScalarMappable. - """ - @cbook.deprecated("3.1", alternative="ScalarMappable.set_norm") - def set_norm(self, norm): - """ - `.colorbar.Colorbar.set_norm` does nothing; set the norm on - the mappable associated with this colorbar. - """ - pass - - @cbook.deprecated("3.1", alternative="ScalarMappable.set_cmap") - def set_cmap(self, cmap): - """ - `.colorbar.Colorbar.set_cmap` does nothing; set the norm on - the mappable associated with this colorbar. - """ - pass - - @cbook.deprecated("3.1", alternative="ScalarMappable.set_clim") - def set_clim(self, vmin=None, vmax=None): - """ - `.colorbar.Colorbar.set_clim` does nothing; set the limits on - the mappable associated with this colorbar. - """ - pass - - @cbook.deprecated("3.1", alternative="ScalarMappable.get_cmap") - def get_cmap(self): - """Return the colormap.""" - return self.cmap - - @cbook.deprecated("3.1", alternative="ScalarMappable.get_clim") - def get_clim(self): - """Return the min, max of the color limits for image scaling.""" - return self.norm.vmin, self.norm.vmax - - -class ColorbarBase(_ColorbarMappableDummy): +class ColorbarBase: r""" Draw a colorbar in an existing axes. diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index d1aa8ebaf4e1..ab420e5bb2d6 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -1357,11 +1357,6 @@ def __init__(self, bbox, self._interp_at_native = interp_at_native self._transform = IdentityTransform() - @cbook.deprecated("3.1") - @property - def interp_at_native(self): - return self._interp_at_native - def get_transform(self): return self._transform diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index c76ed0bc7442..99cd9225573f 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -418,11 +418,6 @@ def __init__(self, xdata, ydata, self.set_data(xdata, ydata) - @cbook.deprecated("3.1") - @property - def verticalOffset(self): - return None - def contains(self, mouseevent): """ Test whether the mouse event occurred on the line. The pick diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index f823f8fff8c1..28977b078fc3 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -2066,137 +2066,6 @@ def polar(*args, **kwargs): return ret -@cbook.deprecated("3.1") -def plotfile(fname, cols=(0,), plotfuncs=None, - comments='#', skiprows=0, checkrows=5, delimiter=',', - names=None, subplots=True, newfig=True, **kwargs): - """ - Plot the data in a file. - - *cols* is a sequence of column identifiers to plot. An identifier - is either an int or a string. If it is an int, it indicates the - column number. If it is a string, it indicates the column header. - matplotlib will make column headers lower case, replace spaces with - underscores, and remove all illegal characters; so ``'Adj Close*'`` - will have name ``'adj_close'``. - - - If len(*cols*) == 1, only that column will be plotted on the *y* axis. - - - If len(*cols*) > 1, the first element will be an identifier for - data for the *x* axis and the remaining elements will be the - column indexes for multiple subplots if *subplots* is *True* - (the default), or for lines in a single subplot if *subplots* - is *False*. - - *plotfuncs*, if not *None*, is a dictionary mapping identifier to - an :class:`~matplotlib.axes.Axes` plotting function as a string. - Default is 'plot', other choices are 'semilogy', 'fill', 'bar', - etc. You must use the same type of identifier in the *cols* - vector as you use in the *plotfuncs* dictionary, e.g., integer - column numbers in both or column names in both. If *subplots* - is *False*, then including any function such as 'semilogy' - that changes the axis scaling will set the scaling for all - columns. - - - *comments*: the character used to indicate the start of a comment - in the file, or *None* to switch off the removal of comments - - - *skiprows*: is the number of rows from the top to skip - - - *checkrows*: is the number of rows to check to validate the column - data type. When set to zero all rows are validated. - - - *delimiter*: is the character(s) separating row items - - - *names*: if not None, is a list of header names. In this case, no - header will be read from the file - - If *newfig* is *True*, the plot always will be made in a new figure; - if *False*, it will be made in the current figure if one exists, - else in a new figure. - - kwargs are passed on to plotting functions. - - Example usage:: - - # plot the 2nd and 4th column against the 1st in two subplots - plotfile(fname, (0, 1, 3)) - - # plot using column names; specify an alternate plot type for volume - plotfile(fname, ('date', 'volume', 'adj_close'), - plotfuncs={'volume': 'semilogy'}) - - Note: plotfile is intended as a convenience for quickly plotting - data from flat files; it is not intended as an alternative - interface to general plotting with pyplot or matplotlib. - """ - - if newfig: - fig = figure() - else: - fig = gcf() - - if len(cols) < 1: - raise ValueError('must have at least one column of data') - - if plotfuncs is None: - plotfuncs = {} - with cbook._suppress_matplotlib_deprecation_warning(): - r = mlab._csv2rec(fname, comments=comments, skiprows=skiprows, - checkrows=checkrows, delimiter=delimiter, - names=names) - - def getname_val(identifier): - 'return the name and column data for identifier' - if isinstance(identifier, str): - return identifier, r[identifier] - elif isinstance(identifier, Number): - name = r.dtype.names[int(identifier)] - return name, r[name] - else: - raise TypeError('identifier must be a string or integer') - - xname, x = getname_val(cols[0]) - ynamelist = [] - - if len(cols) == 1: - ax1 = fig.add_subplot(1, 1, 1) - funcname = plotfuncs.get(cols[0], 'plot') - func = getattr(ax1, funcname) - func(x, **kwargs) - ax1.set_ylabel(xname) - else: - N = len(cols) - for i in range(1, N): - if subplots: - if i == 1: - ax = ax1 = fig.add_subplot(N - 1, 1, i) - else: - ax = fig.add_subplot(N - 1, 1, i, sharex=ax1) - elif i == 1: - ax = fig.add_subplot(1, 1, 1) - - yname, y = getname_val(cols[i]) - ynamelist.append(yname) - - funcname = plotfuncs.get(cols[i], 'plot') - func = getattr(ax, funcname) - - func(x, y, **kwargs) - if subplots: - ax.set_ylabel(yname) - if ax.is_last_row(): - ax.set_xlabel(xname) - else: - ax.set_xlabel('') - - if not subplots: - ax.legend(ynamelist) - - if xname == 'date': - fig.autofmt_xdate() - - # If rcParams['backend_fallback'] is true, and an interactive backend is # requested, ignore rcParams['backend'] and force selection of a backend that # is compatible with the current running interactive framework. diff --git a/lib/matplotlib/quiver.py b/lib/matplotlib/quiver.py index bb356874c216..77dd058c8b8d 100644 --- a/lib/matplotlib/quiver.py +++ b/lib/matplotlib/quiver.py @@ -528,21 +528,6 @@ def on_dpi_change(fig): self._cid = self.ax.figure.callbacks.connect('dpi_changed', on_dpi_change) - @cbook.deprecated("3.1", alternative="get_facecolor()") - @property - def color(self): - return self.get_facecolor() - - @cbook.deprecated("3.1") - @property - def keyvec(self): - return None - - @cbook.deprecated("3.1") - @property - def keytext(self): - return None - def remove(self): """ Overload the remove method diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index d0cd93552c56..1627a363081d 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -248,20 +248,6 @@ def validate_backend(s): return backend -@cbook.deprecated("3.1") -def validate_qt4(s): - if s is None: - return None - return ValidateInStrings("backend.qt4", ['PyQt4', 'PySide', 'PyQt4v2'])(s) - - -@cbook.deprecated("3.1") -def validate_qt5(s): - if s is None: - return None - return ValidateInStrings("backend.qt5", ['PyQt5', 'PySide2'])(s) - - validate_toolbar = ValidateInStrings( 'toolbar', ['None', 'toolbar2', 'toolmanager'], ignorecase=True) @@ -446,11 +432,6 @@ def validate_mathtext_default(s): ['silent', 'helpful', 'debug', 'debug-annoying']) -@cbook.deprecated("3.1") -def validate_verbose(s): - return _validate_verbose(s) - - def validate_whiskers(s): if s == 'range': cbook.warn_deprecated( @@ -667,39 +648,6 @@ def validate_sketch(s): return result -@cbook.deprecated("3.1") -class ValidateInterval: - """ - Value must be in interval - """ - def __init__(self, vmin, vmax, closedmin=True, closedmax=True): - self.vmin = vmin - self.vmax = vmax - self.cmin = closedmin - self.cmax = closedmax - - def __call__(self, s): - try: - s = float(s) - except ValueError: - raise RuntimeError('Value must be a float; found "%s"' % s) - - if self.cmin and s < self.vmin: - raise RuntimeError('Value must be >= %f; found "%f"' % - (self.vmin, s)) - elif not self.cmin and s <= self.vmin: - raise RuntimeError('Value must be > %f; found "%f"' % - (self.vmin, s)) - - if self.cmax and s > self.vmax: - raise RuntimeError('Value must be <= %f; found "%f"' % - (self.vmax, s)) - elif not self.cmax and s >= self.vmax: - raise RuntimeError('Value must be < %f; found "%f"' % - (self.vmax, s)) - return s - - def _validate_greaterequal0_lessthan1(s): s = validate_float(s) if 0 <= s < 1: diff --git a/lib/matplotlib/sphinxext/plot_directive.py b/lib/matplotlib/sphinxext/plot_directive.py index 0b7e45e0ab75..bbcce21a6ba8 100644 --- a/lib/matplotlib/sphinxext/plot_directive.py +++ b/lib/matplotlib/sphinxext/plot_directive.py @@ -163,16 +163,6 @@ # ----------------------------------------------------------------------------- -@cbook.deprecated("3.1", alternative="PlotDirective") -def plot_directive(name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): - """Implementation of the ``.. plot::`` directive. - - See the module docstring for details. - """ - return run(arguments, content, options, state_machine, state, lineno) - - def _option_boolean(arg): if not arg or not arg.strip(): # no argument given, assume used as a flag