|
12 | 12 |
|
13 | 13 | from collections import defaultdict |
14 | 14 | import functools |
15 | | -import inspect |
16 | 15 | import itertools |
17 | 16 | import math |
18 | 17 | from numbers import Integral |
@@ -405,82 +404,41 @@ def draw(self, renderer): |
405 | 404 |
|
406 | 405 | # add the projection matrix to the renderer |
407 | 406 | self.M = self.get_proj() |
408 | | - props3d = { |
409 | | - # To raise a deprecation, we need to wrap the attribute in a |
410 | | - # function, but binding that to an instance does not work, as you |
411 | | - # would end up with an instance-specific method. Properties are |
412 | | - # class-level attributes which *are* functions, so we do that |
413 | | - # instead. |
414 | | - # This dictionary comprehension creates deprecated properties for |
415 | | - # the attributes listed below, and they are temporarily attached to |
416 | | - # the _class_ in the `_setattr_cm` call. These can both be removed |
417 | | - # once the deprecation expires |
418 | | - name: _api.deprecated('3.4', name=name, |
419 | | - alternative=f'self.axes.{name}')( |
420 | | - property(lambda self, _value=getattr(self, name): _value)) |
421 | | - for name in ['M', 'vvec', 'eye', 'get_axis_position'] |
422 | | - } |
423 | | - |
424 | | - with cbook._setattr_cm(type(renderer), **props3d): |
425 | | - def do_3d_projection(artist): |
426 | | - """ |
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. |
433 | | - """ |
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() |
450 | | - |
451 | | - collections_and_patches = ( |
452 | | - artist for artist in self._children |
453 | | - if isinstance(artist, (mcoll.Collection, mpatches.Patch)) |
454 | | - and artist.get_visible()) |
455 | | - if self.computed_zorder: |
456 | | - # Calculate projection of collections and patches and zorder |
457 | | - # them. Make sure they are drawn above the grids. |
458 | | - zorder_offset = max(axis.get_zorder() |
459 | | - for axis in self._get_axis_list()) + 1 |
460 | | - collection_zorder = patch_zorder = zorder_offset |
461 | | - for artist in sorted(collections_and_patches, |
462 | | - key=do_3d_projection, |
463 | | - reverse=True): |
464 | | - if isinstance(artist, mcoll.Collection): |
465 | | - artist.zorder = collection_zorder |
466 | | - collection_zorder += 1 |
467 | | - elif isinstance(artist, mpatches.Patch): |
468 | | - artist.zorder = patch_zorder |
469 | | - patch_zorder += 1 |
470 | | - else: |
471 | | - for artist in collections_and_patches: |
472 | | - artist.do_3d_projection() |
473 | 407 |
|
474 | | - if self._axis3don: |
475 | | - # Draw panes first |
476 | | - for axis in self._get_axis_list(): |
477 | | - axis.draw_pane(renderer) |
478 | | - # Then axes |
479 | | - for axis in self._get_axis_list(): |
480 | | - axis.draw(renderer) |
| 408 | + collections_and_patches = ( |
| 409 | + artist for artist in self._children |
| 410 | + if isinstance(artist, (mcoll.Collection, mpatches.Patch)) |
| 411 | + and artist.get_visible()) |
| 412 | + if self.computed_zorder: |
| 413 | + # Calculate projection of collections and patches and zorder |
| 414 | + # them. Make sure they are drawn above the grids. |
| 415 | + zorder_offset = max(axis.get_zorder() |
| 416 | + for axis in self._get_axis_list()) + 1 |
| 417 | + collection_zorder = patch_zorder = zorder_offset |
| 418 | + |
| 419 | + for artist in sorted(collections_and_patches, |
| 420 | + key=lambda artist: artist.do_3d_projection(), |
| 421 | + reverse=True): |
| 422 | + if isinstance(artist, mcoll.Collection): |
| 423 | + artist.zorder = collection_zorder |
| 424 | + collection_zorder += 1 |
| 425 | + elif isinstance(artist, mpatches.Patch): |
| 426 | + artist.zorder = patch_zorder |
| 427 | + patch_zorder += 1 |
| 428 | + else: |
| 429 | + for artist in collections_and_patches: |
| 430 | + artist.do_3d_projection() |
| 431 | + |
| 432 | + if self._axis3don: |
| 433 | + # Draw panes first |
| 434 | + for axis in self._get_axis_list(): |
| 435 | + axis.draw_pane(renderer) |
| 436 | + # Then axes |
| 437 | + for axis in self._get_axis_list(): |
| 438 | + axis.draw(renderer) |
481 | 439 |
|
482 | | - # Then rest |
483 | | - super().draw(renderer) |
| 440 | + # Then rest |
| 441 | + super().draw(renderer) |
484 | 442 |
|
485 | 443 | def get_axis_position(self): |
486 | 444 | vals = self.get_w_lims() |
@@ -1504,8 +1462,7 @@ def plot(self, xs, ys, *args, zdir='z', **kwargs): |
1504 | 1462 |
|
1505 | 1463 | plot3D = plot |
1506 | 1464 |
|
1507 | | - @_api.delete_parameter("3.4", "args", alternative="kwargs") |
1508 | | - def plot_surface(self, X, Y, Z, *args, norm=None, vmin=None, |
| 1465 | + def plot_surface(self, X, Y, Z, *, norm=None, vmin=None, |
1509 | 1466 | vmax=None, lightsource=None, **kwargs): |
1510 | 1467 | """ |
1511 | 1468 | Create a surface plot. |
@@ -1679,7 +1636,7 @@ def plot_surface(self, X, Y, Z, *args, norm=None, vmin=None, |
1679 | 1636 |
|
1680 | 1637 | # note that the striding causes some polygons to have more coordinates |
1681 | 1638 | # than others |
1682 | | - polyc = art3d.Poly3DCollection(polys, *args, **kwargs) |
| 1639 | + polyc = art3d.Poly3DCollection(polys, **kwargs) |
1683 | 1640 |
|
1684 | 1641 | if fcolors is not None: |
1685 | 1642 | if shade: |
@@ -1790,8 +1747,7 @@ def norm(x): |
1790 | 1747 |
|
1791 | 1748 | return colors |
1792 | 1749 |
|
1793 | | - @_api.delete_parameter("3.4", "args", alternative="kwargs") |
1794 | | - def plot_wireframe(self, X, Y, Z, *args, **kwargs): |
| 1750 | + def plot_wireframe(self, X, Y, Z, **kwargs): |
1795 | 1751 | """ |
1796 | 1752 | Plot a 3D wireframe. |
1797 | 1753 |
|
@@ -1903,7 +1859,7 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs): |
1903 | 1859 | + [list(zip(xl, yl, zl)) |
1904 | 1860 | for xl, yl, zl in zip(txlines, tylines, tzlines)]) |
1905 | 1861 |
|
1906 | | - linec = art3d.Line3DCollection(lines, *args, **kwargs) |
| 1862 | + linec = art3d.Line3DCollection(lines, **kwargs) |
1907 | 1863 | self.add_collection(linec) |
1908 | 1864 | self.auto_scale_xyz(X, Y, Z, had_data) |
1909 | 1865 |
|
|
0 commit comments