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

Skip to content

Commit fb5e6c6

Browse files
committed
Remove APIs deprecated in mpl3.0.
1 parent d062859 commit fb5e6c6

Some content is hidden

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

46 files changed

+96
-1409
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: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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),

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 & 29 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)

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: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4457,13 +4457,6 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
44574457

44584458
scales = s # Renamed for readability below.
44594459

4460-
# to be API compatible
4461-
if verts is not None:
4462-
cbook.warn_deprecated("3.0", name="'verts'", obj_type="kwarg",
4463-
alternative="'marker'")
4464-
if marker is None:
4465-
marker = verts
4466-
44674460
# load default marker from rcParams
44684461
if marker is None:
44694462
marker = rcParams['scatter.marker']
@@ -6568,9 +6561,6 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
65686561
65696562
Default is ``False``
65706563
6571-
normed : bool, optional
6572-
Deprecated; use the density keyword argument instead.
6573-
65746564
Returns
65756565
-------
65766566
n : array or list of arrays
@@ -6620,15 +6610,6 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
66206610
if histtype == 'barstacked' and not stacked:
66216611
stacked = True
66226612

6623-
if density is not None and normed is not None:
6624-
raise ValueError("kwargs 'density' and 'normed' cannot be used "
6625-
"simultaneously. "
6626-
"Please only use 'density', since 'normed'"
6627-
"is deprecated.")
6628-
if normed is not None:
6629-
cbook.warn_deprecated("2.1", name="'normed'", obj_type="kwarg",
6630-
alternative="'density'", removal="3.1")
6631-
66326613
# basic input validation
66336614
input_empty = np.size(x) == 0
66346615
# Massage 'x' for processing.
@@ -6700,7 +6681,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
67006681
else:
67016682
hist_kwargs['range'] = bin_range
67026683

6703-
density = bool(density) or bool(normed)
6684+
density = bool(density)
67046685
if density and not stacked:
67056686
hist_kwargs['density'] = density
67066687

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 = []

lib/matplotlib/backends/backend_ps.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,55 +1450,6 @@ def get_bbox_header(lbrt, rotated=False):
14501450
return '\n'.join([bbox_info, hires_bbox_info]), rotate
14511451

14521452

1453-
# get_bbox is deprecated. I don't see any reason to use ghostscript to
1454-
# find the bounding box, as the required bounding box is alread known.
1455-
@cbook.deprecated("3.0")
1456-
def get_bbox(tmpfile, bbox):
1457-
"""
1458-
Use ghostscript's bbox device to find the center of the bounding box.
1459-
Return an appropriately sized bbox centered around that point. A bit of a
1460-
hack.
1461-
"""
1462-
1463-
gs_exe = ps_backend_helper.gs_exe
1464-
command = [gs_exe, "-dBATCH", "-dNOPAUSE", "-sDEVICE=bbox", "%s" % tmpfile]
1465-
_log.debug(command)
1466-
p = subprocess.Popen(command, stdin=subprocess.PIPE,
1467-
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
1468-
close_fds=True)
1469-
(stdout, stderr) = (p.stdout, p.stderr)
1470-
_log.debug(stdout.read())
1471-
bbox_info = stderr.read()
1472-
_log.info(bbox_info)
1473-
bbox_found = re.search('%%HiResBoundingBox: .*', bbox_info)
1474-
if bbox_found:
1475-
bbox_info = bbox_found.group()
1476-
else:
1477-
raise RuntimeError(
1478-
'Ghostscript was not able to extract a bounding box.'
1479-
'Here is the Ghostscript output:\n\n%s' % bbox_info)
1480-
l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]
1481-
1482-
# this is a hack to deal with the fact that ghostscript does not return the
1483-
# intended bbox, but a tight bbox. For now, we just center the ink in the
1484-
# intended bbox. This is not ideal, users may intend the ink to not be
1485-
# centered.
1486-
if bbox is None:
1487-
l, b, r, t = (l-1, b-1, r+1, t+1)
1488-
else:
1489-
x = (l+r)/2
1490-
y = (b+t)/2
1491-
dx = (bbox[2]-bbox[0])/2
1492-
dy = (bbox[3]-bbox[1])/2
1493-
l, b, r, t = (x-dx, y-dy, x+dx, y+dy)
1494-
1495-
bbox_info = '%%%%BoundingBox: %d %d %d %d' % (l, b, np.ceil(r), np.ceil(t))
1496-
hires_bbox_info = '%%%%HiResBoundingBox: %.6f %.6f %.6f %.6f' % (
1497-
l, b, r, t)
1498-
1499-
return '\n'.join([bbox_info, hires_bbox_info])
1500-
1501-
15021453
def pstoeps(tmpfile, bbox=None, rotated=False):
15031454
"""
15041455
Convert the postscript to encapsulated postscript. The bbox of

0 commit comments

Comments
 (0)