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

Skip to content

Commit 4930fbc

Browse files
committed
Remove APIs deprecated in mpl3.0.
1 parent ad45364 commit 4930fbc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+114
-1485
lines changed

doc/api/artist_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
``matplotlib.artist``
55
*********************
66

7-
.. 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
7+
.. 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
88
:parts: 1
99
:private-bases:
1010

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
API removals
2+
````````````
3+
4+
The following deprecated APIs were removed:
5+
6+
- the ``matplotlib.backends.tkagg``, ``matplotlib.backends.windowing``,
7+
``matplotlib.backends.wx_compat``, and ``matplotlib.compat.subprocess``
8+
modules,
9+
- ``RcParams.msg_depr``, ``RcParams.msg_depr_ignore``,
10+
``RcParams.msg_depr_set``, ``RcParams.msg_obsolete``,
11+
``RcParams.msg_backend_obsolete``,
12+
- ``afm.parse_afm`` (use ``afm.AFM instead``),
13+
- ``axes.Axes.mouseover_set``,
14+
- ``backend_cairo.ArrayWrapper``, ``backend_cairo.RendererCairo.convert_path``,
15+
- ``backend_gtk3.FileChooserDialog.sorted_filetypes`` (use
16+
``sorted(self.filetypes.items())`` instead),
17+
- ``backend_pgf.get_texcommand``,
18+
- ``backend_pdf.PdfFile.texFontMap``,
19+
- ``backend_ps.get_bbox``,
20+
- ``backend_qt.FigureCanvasQt.keyAutoRepeat`` (use
21+
``event.guiEvent.isAutoRepeat`` instead), ``backend_qt.error_msg_qt``,
22+
``backend_qt.exception_handler``,
23+
- ``backend_wx.FigureCanvasWx.macros``,
24+
- ``backends.pylab_setup``,
25+
- ``cbook.Bunch`` (use ``types.SimpleNamespace`` instead), ``cbook.Locked``,
26+
``cbook.unicode_safe``, ``cbook.is_numlike`` (use
27+
``isinstance(..., numbers.Number)`` instead), ``cbook.mkdirs`` (use
28+
``os.makedirs(..., exist_ok=True)`` instead), ``cbook.GetRealpathAndStat``
29+
(use ``cbook.get_realpath_and_stat`` instead),
30+
``cbook.listFiles``,
31+
- ``container.Container.set_remove_method``,
32+
- ``contour.ContourLabeler.cl``, ``contour.ContourLabeler.cl_xy``,
33+
``contour.ContourLabeler.cl_cvalues`` (use ``labelTexts``, ``labelXYs``,
34+
``labelCValues`` instead),
35+
- ``dates.DateFormatter.strftime``, ``dates.DateFormatter.strftime_pre_1900``,
36+
- ``font_manager.TempCache``, ``font_manager.FontManager.ttffiles``,
37+
``font_manager.FontManager.afmfiles``,
38+
- ``mathtext.unichr_safe`` (use ``chr`` instead),
39+
- ``patches.YAArrow`` (use ``patches.FancyArrowPatch`` instead),
40+
- ``sphinxext.plot_directive.remove_coding``,
41+
- ``table.Table.get_child_artists``,
42+
- ``testing.compare.compare_float``, ``testing.decorators.CleanupTest``,
43+
``testing.decorators.ImageComparisonTest``,
44+
``testing.decorators.skip_if_command_unavailable``,
45+
support for nose-based tests,
46+
- ``text.Annotation.arrow`` (use ``text.Annotation.arrow_patch`` instead),
47+
- ``textpath.TextToPath.tex_font_map``,
48+
- ``ticker.Base``, ``ticker.closeto``, ``ticker.nearest_long``,
49+
- ``axes_grid1.axes_divider.LocatableAxesBase``,
50+
``axes_grid1.axes_divider.locatable_axes_factory``,
51+
``axes_grid1.axes_divider.Axes`` (use ``axes_grid1.mpl_axes.Axes`` instead),
52+
``axes_grid1.axes_divider.LocatableAxes`` (use ``axes_grid1.mpl_axes.Axes``
53+
instead),
54+
- ``axisartist.axes_divider.Axes``, ``axisartist.axes_divider.LocatableAxes``
55+
(use ``axisartist.axislines.Axes`` instead),
56+
- the ``normed`` kwarg to ``hist`` (use ``density`` instead),
57+
- the ``verts`` parameter to ``scatter`` (use ``marker`` instead),
58+
- passing ``(verts, 0)`` or ``(..., 3)`` when specifying a marker to specify a
59+
path or a circle, respectively (instead, use ``verts`` or ``"o"``,
60+
respectively),
61+
- :rc:`examples.directory`,

doc/api/patches_api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ Classes
3434
RegularPolygon
3535
Shadow
3636
Wedge
37-
YAArrow
3837

3938
Functions
4039
---------

lib/matplotlib/__init__.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -716,35 +716,6 @@ class RcParams(MutableMapping, dict):
716716
for key, (default, converter) in defaultParams.items()
717717
if key not in _all_deprecated}
718718

719-
@cbook.deprecated("3.0")
720-
@property
721-
def msg_depr(self):
722-
return "%s is deprecated and replaced with %s; please use the latter."
723-
724-
@cbook.deprecated("3.0")
725-
@property
726-
def msg_depr_ignore(self):
727-
return "%s is deprecated and ignored. Use %s instead."
728-
729-
@cbook.deprecated("3.0")
730-
@property
731-
def msg_depr_set(self):
732-
return ("%s is deprecated. Please remove it from your matplotlibrc "
733-
"and/or style files.")
734-
735-
@cbook.deprecated("3.0")
736-
@property
737-
def msg_obsolete(self):
738-
return ("%s is obsolete. Please remove it from your matplotlibrc "
739-
"and/or style files.")
740-
741-
@cbook.deprecated("3.0")
742-
@property
743-
def msg_backend_obsolete(self):
744-
return ("The {} rcParam was deprecated in version 2.2. In order to "
745-
"force the use of a specific Qt binding, either import that "
746-
"binding first, or set the QT_API environment variable.")
747-
748719
# validate values on the way in
749720
def __init__(self, *args, **kwargs):
750721
self.update(*args, **kwargs)
@@ -766,11 +737,6 @@ def __setitem__(self, key, val):
766737
cbook.warn_deprecated(
767738
version, name=key, obj_type="rcparam", alternative=alt_key)
768739
return
769-
elif key == 'examples.directory':
770-
cbook.warn_deprecated(
771-
"3.0", name=key, obj_type="rcparam", addendum="In the "
772-
"future, examples will be found relative to the "
773-
"'datapath' directory.")
774740
elif key == 'backend':
775741
if val is rcsetup._auto_backend_sentinel:
776742
if 'backend' in self:
@@ -798,11 +764,6 @@ def __getitem__(self, key):
798764
version, name=key, obj_type="rcparam", alternative=alt_key)
799765
return dict.__getitem__(self, alt_key) if alt_key else None
800766

801-
elif key == 'examples.directory':
802-
cbook.warn_deprecated(
803-
"3.0", name=key, obj_type="rcparam", addendum="In the future, "
804-
"examples will be found relative to the 'datapath' directory.")
805-
806767
elif key == "backend":
807768
val = dict.__getitem__(self, key)
808769
if val is rcsetup._auto_backend_sentinel:
@@ -990,21 +951,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
990951
# this is the instance used by the matplotlib classes
991952
rcParams = rc_params()
992953

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

1009955
with cbook._suppress_matplotlib_deprecation_warning():
1010956
rcParamsOrig = RcParams(rcParams.copy())

lib/matplotlib/afm.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,6 @@ def _parse_optional(fh):
368368
return d[b'StartKernData'], d[b'StartComposites']
369369

370370

371-
@deprecated("3.0", alternative="the AFM class")
372-
def parse_afm(fh):
373-
return _parse_afm(fh)
374-
375-
376371
def _parse_afm(fh):
377372
"""
378373
Parse the Adobe Font Metrics file in file handle *fh*.

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4313,6 +4313,7 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize,
43134313
"edgecolors", "c", "facecolor",
43144314
"facecolors", "color"],
43154315
label_namer="y")
4316+
@cbook._delete_parameter("3.2", "verts")
43164317
def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
43174318
vmin=None, vmax=None, alpha=None, linewidths=None,
43184319
verts=None, edgecolors=None, *, plotnonfinite=False,
@@ -4465,13 +4466,6 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
44654466

44664467
scales = s # Renamed for readability below.
44674468

4468-
# to be API compatible
4469-
if verts is not None:
4470-
cbook.warn_deprecated("3.0", name="'verts'", obj_type="kwarg",
4471-
alternative="'marker'")
4472-
if marker is None:
4473-
marker = verts
4474-
44754469
# load default marker from rcParams
44764470
if marker is None:
44774471
marker = rcParams['scatter.marker']
@@ -6394,8 +6388,7 @@ def clabel(self, CS, *args, **kwargs):
63946388
def hist(self, x, bins=None, range=None, density=None, weights=None,
63956389
cumulative=False, bottom=None, histtype='bar', align='mid',
63966390
orientation='vertical', rwidth=None, log=False,
6397-
color=None, label=None, stacked=False, normed=None,
6398-
**kwargs):
6391+
color=None, label=None, stacked=False, **kwargs):
63996392
"""
64006393
Plot a histogram.
64016394
@@ -6576,9 +6569,6 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
65766569
65776570
Default is ``False``
65786571
6579-
normed : bool, optional
6580-
Deprecated; use the density keyword argument instead.
6581-
65826572
Returns
65836573
-------
65846574
n : array or list of arrays
@@ -6628,15 +6618,6 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
66286618
if histtype == 'barstacked' and not stacked:
66296619
stacked = True
66306620

6631-
if density is not None and normed is not None:
6632-
raise ValueError("kwargs 'density' and 'normed' cannot be used "
6633-
"simultaneously. "
6634-
"Please only use 'density', since 'normed'"
6635-
"is deprecated.")
6636-
if normed is not None:
6637-
cbook.warn_deprecated("2.1", name="'normed'", obj_type="kwarg",
6638-
alternative="'density'", removal="3.1")
6639-
66406621
# basic input validation
66416622
input_empty = np.size(x) == 0
66426623
# Massage 'x' for processing.
@@ -6708,7 +6689,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
67086689
else:
67096690
hist_kwargs['range'] = bin_range
67106691

6711-
density = bool(density) or bool(normed)
6692+
density = bool(density)
67126693
if density and not stacked:
67136694
hist_kwargs['density'] = density
67146695

lib/matplotlib/axes/_base.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,11 +1124,6 @@ def cla(self):
11241124

11251125
self.stale = True
11261126

1127-
@cbook.deprecated("3.0")
1128-
@property
1129-
def mouseover_set(self):
1130-
return frozenset(self._mouseover_set)
1131-
11321127
def clear(self):
11331128
"""Clear the axes."""
11341129
self.cla()

lib/matplotlib/backends/__init__.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -52,54 +52,3 @@ def _get_running_interactive_framework():
5252
if sys.platform.startswith("linux") and not os.environ.get("DISPLAY"):
5353
return "headless"
5454
return None
55-
56-
57-
@cbook.deprecated("3.0")
58-
def pylab_setup(name=None):
59-
"""
60-
Return new_figure_manager, draw_if_interactive and show for pyplot.
61-
62-
This provides the backend-specific functions that are used by pyplot to
63-
abstract away the difference between backends.
64-
65-
Parameters
66-
----------
67-
name : str, optional
68-
The name of the backend to use. If `None`, falls back to
69-
``matplotlib.get_backend()`` (which return :rc:`backend`).
70-
71-
Returns
72-
-------
73-
backend_mod : module
74-
The module which contains the backend of choice
75-
76-
new_figure_manager : function
77-
Create a new figure manager (roughly maps to GUI window)
78-
79-
draw_if_interactive : function
80-
Redraw the current figure if pyplot is interactive
81-
82-
show : function
83-
Show (and possibly block) any unshown figures.
84-
"""
85-
# Import the requested backend into a generic module object.
86-
if name is None:
87-
name = matplotlib.get_backend()
88-
backend_name = (name[9:] if name.startswith("module://")
89-
else "matplotlib.backends.backend_{}".format(name.lower()))
90-
backend_mod = importlib.import_module(backend_name)
91-
# Create a local Backend class whose body corresponds to the contents of
92-
# the backend module. This allows the Backend class to fill in the missing
93-
# methods through inheritance.
94-
Backend = type("Backend", (_Backend,), vars(backend_mod))
95-
96-
# Need to keep a global reference to the backend for compatibility reasons.
97-
# See https://github.com/matplotlib/matplotlib/issues/6092
98-
global backend
99-
backend = name
100-
101-
_log.debug('backend %s version %s', name, Backend.backend_version)
102-
return (backend_mod,
103-
Backend.new_figure_manager,
104-
Backend.draw_if_interactive,
105-
Backend.show)

lib/matplotlib/backends/backend_cairo.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,6 @@ def _to_context(ctx):
5151
return ctx
5252

5353

54-
@cbook.deprecated("3.0")
55-
class ArrayWrapper:
56-
"""Thin wrapper around numpy ndarray to expose the interface
57-
expected by cairocffi. Basically replicates the
58-
array.array interface.
59-
"""
60-
def __init__(self, myarray):
61-
self.__array = myarray
62-
self.__data = myarray.ctypes.data
63-
self.__size = len(myarray.flatten())
64-
self.itemsize = myarray.itemsize
65-
66-
def buffer_info(self):
67-
return (self.__data, self.__size)
68-
69-
7054
def _append_path(ctx, path, transform, clip=None):
7155
for points, code in path.iter_segments(
7256
transform, remove_nans=True, clip=clip):
@@ -143,11 +127,6 @@ def _fill_and_stroke(self, ctx, fill_c, alpha, alpha_overrides):
143127
ctx.restore()
144128
ctx.stroke()
145129

146-
@staticmethod
147-
@cbook.deprecated("3.0")
148-
def convert_path(ctx, path, transform, clip=None):
149-
_append_path(ctx, path, transform, clip)
150-
151130
def draw_path(self, gc, path, transform, rgbFace=None):
152131
# docstring inherited
153132
ctx = gc.ctx

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,6 @@ def cb_cbox_changed(cbox, data=None):
682682
hbox.show_all()
683683
self.set_extra_widget(hbox)
684684

685-
@cbook.deprecated("3.0", alternative="sorted(self.filetypes.items())")
686-
def sorted_filetypes(self):
687-
return sorted(self.filetypes.items())
688-
689685
def get_filename_from_user(self):
690686
if self.run() == int(Gtk.ResponseType.OK):
691687
return self.get_filename(), self.ext

lib/matplotlib/backends/backend_pdf.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -651,13 +651,6 @@ def fontName(self, fontprop):
651651

652652
return Fx
653653

654-
@cbook.deprecated("3.0")
655-
@property
656-
def texFontMap(self):
657-
# lazy-load texFontMap, it takes a while to parse
658-
# and usetex is a relatively rare use case
659-
return dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))
660-
661654
def dviFontName(self, dvifont):
662655
"""
663656
Given a dvi font object, return a name suitable for Op.selectfont.

lib/matplotlib/backends/backend_pgf.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@
2828
###############################################################################
2929

3030

31-
@cbook.deprecated("3.0")
32-
def get_texcommand():
33-
"""Get chosen TeX system from rc."""
34-
texsystem_options = ["xelatex", "lualatex", "pdflatex"]
35-
texsystem = rcParams["pgf.texsystem"]
36-
return texsystem if texsystem in texsystem_options else "xelatex"
37-
38-
3931
def get_fontspec():
4032
"""Build fontspec preamble from rc."""
4133
latex_fontspec = []

0 commit comments

Comments
 (0)