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

Skip to content

Remove APIs deprecated in mpl3.0. #14244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/api/artist_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
``matplotlib.artist``
*********************

.. inheritance-diagram:: matplotlib.axes._axes.Axes matplotlib.axes._base._AxesBase matplotlib.axis.Axis matplotlib.axis.Tick matplotlib.axis.XAxis matplotlib.axis.XTick matplotlib.axis.YAxis matplotlib.axis.YTick matplotlib.collections.AsteriskPolygonCollection matplotlib.collections.BrokenBarHCollection matplotlib.collections.CircleCollection matplotlib.collections.Collection matplotlib.collections.EllipseCollection matplotlib.collections.EventCollection matplotlib.collections.LineCollection matplotlib.collections.PatchCollection matplotlib.collections.PathCollection matplotlib.collections.PolyCollection matplotlib.collections.QuadMesh matplotlib.collections.RegularPolyCollection matplotlib.collections.StarPolygonCollection matplotlib.collections.TriMesh matplotlib.collections._CollectionWithSizes matplotlib.contour.ClabelText matplotlib.figure.Figure matplotlib.image.AxesImage matplotlib.image.BboxImage matplotlib.image.FigureImage matplotlib.image.NonUniformImage matplotlib.image.PcolorImage matplotlib.image._ImageBase matplotlib.legend.Legend matplotlib.lines.Line2D matplotlib.offsetbox.AnchoredOffsetbox matplotlib.offsetbox.AnchoredText matplotlib.offsetbox.AnnotationBbox matplotlib.offsetbox.AuxTransformBox matplotlib.offsetbox.DrawingArea matplotlib.offsetbox.HPacker matplotlib.offsetbox.OffsetBox matplotlib.offsetbox.OffsetImage matplotlib.offsetbox.PackerBase matplotlib.offsetbox.PaddedBox matplotlib.offsetbox.TextArea matplotlib.offsetbox.VPacker matplotlib.patches.Arc matplotlib.patches.Arrow matplotlib.patches.Circle matplotlib.patches.CirclePolygon matplotlib.patches.ConnectionPatch matplotlib.patches.Ellipse matplotlib.patches.FancyArrow matplotlib.patches.FancyArrowPatch matplotlib.patches.FancyBboxPatch matplotlib.patches.Patch matplotlib.patches.PathPatch matplotlib.patches.Polygon matplotlib.patches.Rectangle matplotlib.patches.RegularPolygon matplotlib.patches.Shadow matplotlib.patches.Wedge matplotlib.patches.YAArrow matplotlib.projections.geo.AitoffAxes matplotlib.projections.geo.GeoAxes matplotlib.projections.geo.HammerAxes matplotlib.projections.geo.LambertAxes matplotlib.projections.geo.MollweideAxes matplotlib.projections.polar.PolarAxes matplotlib.quiver.Barbs matplotlib.quiver.Quiver matplotlib.quiver.QuiverKey matplotlib.spines.Spine matplotlib.table.Cell matplotlib.table.CustomCell matplotlib.table.Table matplotlib.text.Annotation matplotlib.text.Text matplotlib.text.TextWithDash
.. inheritance-diagram:: matplotlib.axes._axes.Axes matplotlib.axes._base._AxesBase matplotlib.axis.Axis matplotlib.axis.Tick matplotlib.axis.XAxis matplotlib.axis.XTick matplotlib.axis.YAxis matplotlib.axis.YTick matplotlib.collections.AsteriskPolygonCollection matplotlib.collections.BrokenBarHCollection matplotlib.collections.CircleCollection matplotlib.collections.Collection matplotlib.collections.EllipseCollection matplotlib.collections.EventCollection matplotlib.collections.LineCollection matplotlib.collections.PatchCollection matplotlib.collections.PathCollection matplotlib.collections.PolyCollection matplotlib.collections.QuadMesh matplotlib.collections.RegularPolyCollection matplotlib.collections.StarPolygonCollection matplotlib.collections.TriMesh matplotlib.collections._CollectionWithSizes matplotlib.contour.ClabelText matplotlib.figure.Figure matplotlib.image.AxesImage matplotlib.image.BboxImage matplotlib.image.FigureImage matplotlib.image.NonUniformImage matplotlib.image.PcolorImage matplotlib.image._ImageBase matplotlib.legend.Legend matplotlib.lines.Line2D matplotlib.offsetbox.AnchoredOffsetbox matplotlib.offsetbox.AnchoredText matplotlib.offsetbox.AnnotationBbox matplotlib.offsetbox.AuxTransformBox matplotlib.offsetbox.DrawingArea matplotlib.offsetbox.HPacker matplotlib.offsetbox.OffsetBox matplotlib.offsetbox.OffsetImage matplotlib.offsetbox.PackerBase matplotlib.offsetbox.PaddedBox matplotlib.offsetbox.TextArea matplotlib.offsetbox.VPacker matplotlib.patches.Arc matplotlib.patches.Arrow matplotlib.patches.Circle matplotlib.patches.CirclePolygon matplotlib.patches.ConnectionPatch matplotlib.patches.Ellipse matplotlib.patches.FancyArrow matplotlib.patches.FancyArrowPatch matplotlib.patches.FancyBboxPatch matplotlib.patches.Patch matplotlib.patches.PathPatch matplotlib.patches.Polygon matplotlib.patches.Rectangle matplotlib.patches.RegularPolygon matplotlib.patches.Shadow matplotlib.patches.Wedge matplotlib.projections.geo.AitoffAxes matplotlib.projections.geo.GeoAxes matplotlib.projections.geo.HammerAxes matplotlib.projections.geo.LambertAxes matplotlib.projections.geo.MollweideAxes matplotlib.projections.polar.PolarAxes matplotlib.quiver.Barbs matplotlib.quiver.Quiver matplotlib.quiver.QuiverKey matplotlib.spines.Spine matplotlib.table.Cell matplotlib.table.CustomCell matplotlib.table.Table matplotlib.text.Annotation matplotlib.text.Text matplotlib.text.TextWithDash
:parts: 1
:private-bases:

Expand Down
61 changes: 61 additions & 0 deletions doc/api/next_api_changes/2019-05-18-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
API removals
````````````

The following deprecated APIs were removed:

- the ``matplotlib.backends.tkagg``, ``matplotlib.backends.windowing``,
``matplotlib.backends.wx_compat``, and ``matplotlib.compat.subprocess``
modules,
- ``RcParams.msg_depr``, ``RcParams.msg_depr_ignore``,
``RcParams.msg_depr_set``, ``RcParams.msg_obsolete``,
``RcParams.msg_backend_obsolete``,
- ``afm.parse_afm`` (use ``afm.AFM instead``),
- ``axes.Axes.mouseover_set``,
- ``backend_cairo.ArrayWrapper``, ``backend_cairo.RendererCairo.convert_path``,
- ``backend_gtk3.FileChooserDialog.sorted_filetypes`` (use
``sorted(self.filetypes.items())`` instead),
- ``backend_pgf.get_texcommand``,
- ``backend_pdf.PdfFile.texFontMap``,
- ``backend_ps.get_bbox``,
- ``backend_qt.FigureCanvasQt.keyAutoRepeat`` (use
``event.guiEvent.isAutoRepeat`` instead), ``backend_qt.error_msg_qt``,
``backend_qt.exception_handler``,
- ``backend_wx.FigureCanvasWx.macros``,
- ``backends.pylab_setup``,
- ``cbook.Bunch`` (use ``types.SimpleNamespace`` instead), ``cbook.Locked``,
``cbook.unicode_safe``, ``cbook.is_numlike`` (use
``isinstance(..., numbers.Number)`` instead), ``cbook.mkdirs`` (use
``os.makedirs(..., exist_ok=True)`` instead), ``cbook.GetRealpathAndStat``
(use ``cbook.get_realpath_and_stat`` instead),
``cbook.listFiles``,
- ``container.Container.set_remove_method``,
- ``contour.ContourLabeler.cl``, ``contour.ContourLabeler.cl_xy``,
``contour.ContourLabeler.cl_cvalues`` (use ``labelTexts``, ``labelXYs``,
``labelCValues`` instead),
- ``dates.DateFormatter.strftime``, ``dates.DateFormatter.strftime_pre_1900``,
- ``font_manager.TempCache``, ``font_manager.FontManager.ttffiles``,
``font_manager.FontManager.afmfiles``,
- ``mathtext.unichr_safe`` (use ``chr`` instead),
- ``patches.YAArrow`` (use ``patches.FancyArrowPatch`` instead),
- ``sphinxext.plot_directive.remove_coding``,
- ``table.Table.get_child_artists``,
- ``testing.compare.compare_float``, ``testing.decorators.CleanupTest``,
``testing.decorators.ImageComparisonTest``,
``testing.decorators.skip_if_command_unavailable``,
support for nose-based tests,
- ``text.Annotation.arrow`` (use ``text.Annotation.arrow_patch`` instead),
- ``textpath.TextToPath.tex_font_map``,
- ``ticker.Base``, ``ticker.closeto``, ``ticker.nearest_long``,
- ``axes_grid1.axes_divider.LocatableAxesBase``,
``axes_grid1.axes_divider.locatable_axes_factory``,
``axes_grid1.axes_divider.Axes`` (use ``axes_grid1.mpl_axes.Axes`` instead),
``axes_grid1.axes_divider.LocatableAxes`` (use ``axes_grid1.mpl_axes.Axes``
instead),
- ``axisartist.axes_divider.Axes``, ``axisartist.axes_divider.LocatableAxes``
(use ``axisartist.axislines.Axes`` instead),
- the ``normed`` kwarg to ``hist`` (use ``density`` instead),
- the ``verts`` parameter to ``scatter`` (use ``marker`` instead),
- passing ``(verts, 0)`` or ``(..., 3)`` when specifying a marker to specify a
path or a circle, respectively (instead, use ``verts`` or ``"o"``,
respectively),
- :rc:`examples.directory`,
1 change: 0 additions & 1 deletion doc/api/patches_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Classes
RegularPolygon
Shadow
Wedge
YAArrow

Functions
---------
Expand Down
54 changes: 0 additions & 54 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,35 +716,6 @@ class RcParams(MutableMapping, dict):
for key, (default, converter) in defaultParams.items()
if key not in _all_deprecated}

@cbook.deprecated("3.0")
@property
def msg_depr(self):
return "%s is deprecated and replaced with %s; please use the latter."

@cbook.deprecated("3.0")
@property
def msg_depr_ignore(self):
return "%s is deprecated and ignored. Use %s instead."

@cbook.deprecated("3.0")
@property
def msg_depr_set(self):
return ("%s is deprecated. Please remove it from your matplotlibrc "
"and/or style files.")

@cbook.deprecated("3.0")
@property
def msg_obsolete(self):
return ("%s is obsolete. Please remove it from your matplotlibrc "
"and/or style files.")

@cbook.deprecated("3.0")
@property
def msg_backend_obsolete(self):
return ("The {} rcParam was deprecated in version 2.2. In order to "
"force the use of a specific Qt binding, either import that "
"binding first, or set the QT_API environment variable.")

# validate values on the way in
def __init__(self, *args, **kwargs):
self.update(*args, **kwargs)
Expand All @@ -766,11 +737,6 @@ def __setitem__(self, key, val):
cbook.warn_deprecated(
version, name=key, obj_type="rcparam", alternative=alt_key)
return
elif key == 'examples.directory':
cbook.warn_deprecated(
"3.0", name=key, obj_type="rcparam", addendum="In the "
"future, examples will be found relative to the "
"'datapath' directory.")
elif key == 'backend':
if val is rcsetup._auto_backend_sentinel:
if 'backend' in self:
Expand Down Expand Up @@ -798,11 +764,6 @@ def __getitem__(self, key):
version, name=key, obj_type="rcparam", alternative=alt_key)
return dict.__getitem__(self, alt_key) if alt_key else None

elif key == 'examples.directory':
cbook.warn_deprecated(
"3.0", name=key, obj_type="rcparam", addendum="In the future, "
"examples will be found relative to the 'datapath' directory.")

elif key == "backend":
val = dict.__getitem__(self, key)
if val is rcsetup._auto_backend_sentinel:
Expand Down Expand Up @@ -990,21 +951,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
# this is the instance used by the matplotlib classes
rcParams = rc_params()

# Don't trigger deprecation warning when just fetching.
if dict.__getitem__(rcParams, 'examples.directory'):
# paths that are intended to be relative to matplotlib_fname()
# are allowed for the examples.directory parameter.
# However, we will need to fully qualify the path because
# Sphinx requires absolute paths.
if not os.path.isabs(rcParams['examples.directory']):
_basedir, _fname = os.path.split(matplotlib_fname())
# Sometimes matplotlib_fname() can return relative paths,
# Also, using realpath() guarantees that Sphinx will use
# the same path that matplotlib sees (in case of weird symlinks).
_basedir = os.path.realpath(_basedir)
_fullpath = os.path.join(_basedir, rcParams['examples.directory'])
rcParams['examples.directory'] = _fullpath


with cbook._suppress_matplotlib_deprecation_warning():
rcParamsOrig = RcParams(rcParams.copy())
Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/afm.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,6 @@ def _parse_optional(fh):
return d[b'StartKernData'], d[b'StartComposites']


@deprecated("3.0", alternative="the AFM class")
def parse_afm(fh):
return _parse_afm(fh)


def _parse_afm(fh):
"""
Parse the Adobe Font Metrics file in file handle *fh*.
Expand Down
25 changes: 3 additions & 22 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4313,6 +4313,7 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize,
"edgecolors", "c", "facecolor",
"facecolors", "color"],
label_namer="y")
@cbook._delete_parameter("3.2", "verts")
def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
vmin=None, vmax=None, alpha=None, linewidths=None,
verts=None, edgecolors=None, *, plotnonfinite=False,
Expand Down Expand Up @@ -4465,13 +4466,6 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,

scales = s # Renamed for readability below.

# to be API compatible
if verts is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verts should be be removed from the method signature. Unfortunately, strictly speaking this would be a breaking change again because you change the position of edgecolors. But nevertheless I think that's what we should do - and since edgecolors is changing its position anyway, you can move the kwonly marker * before it.

The alternative would be to keep verts and raise a TypeError here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a _delete_parameter on verts. Sure, that'll take two more minor versions before removing it from the signature, but heh, there's no urgency either...

cbook.warn_deprecated("3.0", name="'verts'", obj_type="kwarg",
alternative="'marker'")
if marker is None:
marker = verts

# load default marker from rcParams
if marker is None:
marker = rcParams['scatter.marker']
Expand Down Expand Up @@ -6394,8 +6388,7 @@ def clabel(self, CS, *args, **kwargs):
def hist(self, x, bins=None, range=None, density=None, weights=None,
cumulative=False, bottom=None, histtype='bar', align='mid',
orientation='vertical', rwidth=None, log=False,
color=None, label=None, stacked=False, normed=None,
**kwargs):
color=None, label=None, stacked=False, **kwargs):
"""
Plot a histogram.

Expand Down Expand Up @@ -6576,9 +6569,6 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,

Default is ``False``

normed : bool, optional
Deprecated; use the density keyword argument instead.

Returns
-------
n : array or list of arrays
Expand Down Expand Up @@ -6628,15 +6618,6 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
if histtype == 'barstacked' and not stacked:
stacked = True

if density is not None and normed is not None:
raise ValueError("kwargs 'density' and 'normed' cannot be used "
"simultaneously. "
"Please only use 'density', since 'normed'"
"is deprecated.")
if normed is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove normed from signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, fixed

cbook.warn_deprecated("2.1", name="'normed'", obj_type="kwarg",
alternative="'density'", removal="3.1")

# basic input validation
input_empty = np.size(x) == 0
# Massage 'x' for processing.
Expand Down Expand Up @@ -6708,7 +6689,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
else:
hist_kwargs['range'] = bin_range

density = bool(density) or bool(normed)
density = bool(density)
if density and not stacked:
hist_kwargs['density'] = density

Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,11 +1124,6 @@ def cla(self):

self.stale = True

@cbook.deprecated("3.0")
@property
def mouseover_set(self):
return frozenset(self._mouseover_set)

def clear(self):
"""Clear the axes."""
self.cla()
Expand Down
51 changes: 0 additions & 51 deletions lib/matplotlib/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,54 +52,3 @@ def _get_running_interactive_framework():
if sys.platform.startswith("linux") and not os.environ.get("DISPLAY"):
return "headless"
return None


@cbook.deprecated("3.0")
def pylab_setup(name=None):
"""
Return new_figure_manager, draw_if_interactive and show for pyplot.

This provides the backend-specific functions that are used by pyplot to
abstract away the difference between backends.

Parameters
----------
name : str, optional
The name of the backend to use. If `None`, falls back to
``matplotlib.get_backend()`` (which return :rc:`backend`).

Returns
-------
backend_mod : module
The module which contains the backend of choice

new_figure_manager : function
Create a new figure manager (roughly maps to GUI window)

draw_if_interactive : function
Redraw the current figure if pyplot is interactive

show : function
Show (and possibly block) any unshown figures.
"""
# Import the requested backend into a generic module object.
if name is None:
name = matplotlib.get_backend()
backend_name = (name[9:] if name.startswith("module://")
else "matplotlib.backends.backend_{}".format(name.lower()))
backend_mod = importlib.import_module(backend_name)
# Create a local Backend class whose body corresponds to the contents of
# the backend module. This allows the Backend class to fill in the missing
# methods through inheritance.
Backend = type("Backend", (_Backend,), vars(backend_mod))

# Need to keep a global reference to the backend for compatibility reasons.
# See https://github.com/matplotlib/matplotlib/issues/6092
global backend
backend = name

_log.debug('backend %s version %s', name, Backend.backend_version)
return (backend_mod,
Backend.new_figure_manager,
Backend.draw_if_interactive,
Backend.show)
21 changes: 0 additions & 21 deletions lib/matplotlib/backends/backend_cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,6 @@ def _to_context(ctx):
return ctx


@cbook.deprecated("3.0")
class ArrayWrapper:
"""Thin wrapper around numpy ndarray to expose the interface
expected by cairocffi. Basically replicates the
array.array interface.
"""
def __init__(self, myarray):
self.__array = myarray
self.__data = myarray.ctypes.data
self.__size = len(myarray.flatten())
self.itemsize = myarray.itemsize

def buffer_info(self):
return (self.__data, self.__size)


def _append_path(ctx, path, transform, clip=None):
for points, code in path.iter_segments(
transform, remove_nans=True, clip=clip):
Expand Down Expand Up @@ -143,11 +127,6 @@ def _fill_and_stroke(self, ctx, fill_c, alpha, alpha_overrides):
ctx.restore()
ctx.stroke()

@staticmethod
@cbook.deprecated("3.0")
def convert_path(ctx, path, transform, clip=None):
_append_path(ctx, path, transform, clip)

def draw_path(self, gc, path, transform, rgbFace=None):
# docstring inherited
ctx = gc.ctx
Expand Down
4 changes: 0 additions & 4 deletions lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,10 +682,6 @@ def cb_cbox_changed(cbox, data=None):
hbox.show_all()
self.set_extra_widget(hbox)

@cbook.deprecated("3.0", alternative="sorted(self.filetypes.items())")
def sorted_filetypes(self):
return sorted(self.filetypes.items())

def get_filename_from_user(self):
if self.run() == int(Gtk.ResponseType.OK):
return self.get_filename(), self.ext
Expand Down
7 changes: 0 additions & 7 deletions lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,13 +651,6 @@ def fontName(self, fontprop):

return Fx

@cbook.deprecated("3.0")
@property
def texFontMap(self):
# lazy-load texFontMap, it takes a while to parse
# and usetex is a relatively rare use case
return dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))

def dviFontName(self, dvifont):
"""
Given a dvi font object, return a name suitable for Op.selectfont.
Expand Down
8 changes: 0 additions & 8 deletions lib/matplotlib/backends/backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@
###############################################################################


@cbook.deprecated("3.0")
def get_texcommand():
"""Get chosen TeX system from rc."""
texsystem_options = ["xelatex", "lualatex", "pdflatex"]
texsystem = rcParams["pgf.texsystem"]
return texsystem if texsystem in texsystem_options else "xelatex"


def get_fontspec():
"""Build fontspec preamble from rc."""
latex_fontspec = []
Expand Down
Loading