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

Skip to content

Commit bbe76a1

Browse files
committed
Remove expired renderer arg deprecations
Finish up renderer arg deprecation
1 parent 82e5939 commit bbe76a1

File tree

4 files changed

+18
-94
lines changed

4 files changed

+18
-94
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Removal of ``renderer`` arguments in mplot3d
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
The deprecated ``renderer`` arguments have been removed from:
4+
5+
- `.Line3DCollection.do_3d_projection`
6+
- `.Patch3D.do_3d_projection`
7+
- `.PathPatch3D.do_3d_projection`
8+
- `.Path3DCollection.do_3d_projection`
9+
- `.Patch3DCollection.do_3d_projection`
10+
- `.Poly3DCollection.do_3d_projection`

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,7 @@ def set_segments(self, segments):
297297
self._segments3d = segments
298298
super().set_segments([])
299299

300-
@_api.delete_parameter('3.4', 'renderer')
301-
def do_3d_projection(self, renderer=None):
300+
def do_3d_projection(self):
302301
"""
303302
Project the points according to renderer matrix.
304303
"""
@@ -346,8 +345,7 @@ def set_3d_properties(self, verts, zs=0, zdir='z'):
346345
def get_path(self):
347346
return self._path2d
348347

349-
@_api.delete_parameter('3.4', 'renderer')
350-
def do_3d_projection(self, renderer=None):
348+
def do_3d_projection(self):
351349
s = self._segment3d
352350
xs, ys, zs = zip(*s)
353351
vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs,
@@ -370,8 +368,7 @@ def set_3d_properties(self, path, zs=0, zdir='z'):
370368
Patch3D.set_3d_properties(self, path.vertices, zs=zs, zdir=zdir)
371369
self._code3d = path.codes
372370

373-
@_api.delete_parameter('3.4', 'renderer')
374-
def do_3d_projection(self, renderer=None):
371+
def do_3d_projection(self):
375372
s = self._segment3d
376373
xs, ys, zs = zip(*s)
377374
vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs,
@@ -466,8 +463,7 @@ def set_3d_properties(self, zs, zdir):
466463
self._vzs = None
467464
self.stale = True
468465

469-
@_api.delete_parameter('3.4', 'renderer')
470-
def do_3d_projection(self, renderer=None):
466+
def do_3d_projection(self):
471467
xs, ys, zs = self._offsets3d
472468
vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs,
473469
self.axes.M)
@@ -594,8 +590,7 @@ def set_depthshade(self, depthshade):
594590
self._depthshade = depthshade
595591
self.stale = True
596592

597-
@_api.delete_parameter('3.4', 'renderer')
598-
def do_3d_projection(self, renderer=None):
593+
def do_3d_projection(self):
599594
xs, ys, zs = self._offsets3d
600595
vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs,
601596
self.axes.M)
@@ -786,8 +781,7 @@ def set_sort_zpos(self, val):
786781
self._sort_zpos = val
787782
self.stale = True
788783

789-
@_api.delete_parameter('3.4', 'renderer')
790-
def do_3d_projection(self, renderer=None):
784+
def do_3d_projection(self):
791785
"""
792786
Perform the 3D projection for this object.
793787
"""

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -424,29 +424,9 @@ def draw(self, renderer):
424424
with cbook._setattr_cm(type(renderer), **props3d):
425425
def do_3d_projection(artist):
426426
"""
427-
Call `do_3d_projection` on an *artist*, and warn if passing
428-
*renderer*.
429-
430-
Attempt to bind the empty signature first, so external Artists
431-
can avoid the deprecation warning if they support the new
432-
calling convention.
427+
Call `do_3d_projection` on an *artist*.
433428
"""
434-
try:
435-
signature = inspect.signature(artist.do_3d_projection)
436-
signature.bind()
437-
# ValueError if `inspect.signature` cannot provide a signature
438-
# and TypeError if the binding fails or the object does not
439-
# appear to be callable - the next call will then re-raise.
440-
except (ValueError, TypeError):
441-
_api.warn_deprecated(
442-
"3.4",
443-
message="The 'renderer' parameter of "
444-
"do_3d_projection() was deprecated in Matplotlib "
445-
"%(since)s and will be removed %(removal)s.")
446-
return artist.do_3d_projection(renderer)
447-
else:
448-
# Call this directly once the deprecation period expires.
449-
return artist.do_3d_projection()
429+
return artist.do_3d_projection()
450430

451431
collections_and_patches = (
452432
artist for artist in self._children

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,63 +1713,3 @@ def test_view_init_vertical_axis(
17131713
tickdir_expected = tickdirs_expected[i]
17141714
tickdir_actual = axis._get_tickdir()
17151715
np.testing.assert_array_equal(tickdir_expected, tickdir_actual)
1716-
1717-
1718-
def test_do_3d_projection_renderer_deprecation_warn_on_argument():
1719-
"""
1720-
Test that an external artist with an old-style calling convention raises
1721-
a suitable deprecation warning.
1722-
"""
1723-
class DummyPatch(art3d.Patch3D):
1724-
def do_3d_projection(self, renderer):
1725-
return 0
1726-
1727-
def draw(self, renderer):
1728-
pass
1729-
1730-
fig = plt.figure()
1731-
ax = fig.add_subplot(111, projection='3d')
1732-
artist = DummyPatch()
1733-
ax.add_artist(artist)
1734-
1735-
match = r"The 'renderer' parameter of do_3d_projection\(\) was deprecated"
1736-
with pytest.warns(MatplotlibDeprecationWarning, match=match):
1737-
fig.canvas.draw()
1738-
1739-
1740-
def test_do_3d_projection_renderer_deprecation_nowarn_on_optional_argument():
1741-
"""
1742-
Test that an external artist with a calling convention compatible with
1743-
both v3.3 and v3.4 does not raise a deprecation warning.
1744-
"""
1745-
class DummyPatch(art3d.Patch3D):
1746-
def do_3d_projection(self, renderer=None):
1747-
return 0
1748-
1749-
def draw(self, renderer):
1750-
pass
1751-
1752-
fig = plt.figure()
1753-
ax = fig.add_subplot(111, projection='3d')
1754-
artist = DummyPatch()
1755-
ax.add_artist(artist)
1756-
fig.canvas.draw()
1757-
1758-
1759-
def test_do_3d_projection_renderer_deprecation_nowarn_on_no_argument():
1760-
"""
1761-
Test that an external artist with a calling convention compatible with
1762-
only v3.4 does not raise a deprecation warning.
1763-
"""
1764-
class DummyPatch(art3d.Patch3D):
1765-
def do_3d_projection(self):
1766-
return 0
1767-
1768-
def draw(self, renderer):
1769-
pass
1770-
1771-
fig = plt.figure()
1772-
ax = fig.add_subplot(111, projection='3d')
1773-
artist = DummyPatch()
1774-
ax.add_artist(artist)
1775-
fig.canvas.draw()

0 commit comments

Comments
 (0)