diff --git a/doc/api/next_api_changes/2018-10-04-AL-deprecations.rst b/doc/api/next_api_changes/2018-10-04-AL-deprecations.rst new file mode 100644 index 000000000000..25506d6f0ffc --- /dev/null +++ b/doc/api/next_api_changes/2018-10-04-AL-deprecations.rst @@ -0,0 +1,5 @@ +Deprecations +```````````` + +``axes3d.Axes3D.w_xaxis``, ``.w_yaxis``, and ``.w_zaxis`` are deprecated (use +``.xaxis``, ``.yaxis``, and ``.zaxis`` instead). diff --git a/examples/mplot3d/surface3d_3.py b/examples/mplot3d/surface3d_3.py index b2f993987051..5eb6ab6b9032 100644 --- a/examples/mplot3d/surface3d_3.py +++ b/examples/mplot3d/surface3d_3.py @@ -36,6 +36,6 @@ # Customize the z axis. ax.set_zlim(-1, 1) -ax.w_zaxis.set_major_locator(LinearLocator(6)) +ax.zaxis.set_major_locator(LinearLocator(6)) plt.show() diff --git a/examples/pyplots/whats_new_1_subplot3d.py b/examples/pyplots/whats_new_1_subplot3d.py index 1996e18f96f3..a16a20a11bbd 100644 --- a/examples/pyplots/whats_new_1_subplot3d.py +++ b/examples/pyplots/whats_new_1_subplot3d.py @@ -23,8 +23,8 @@ linewidth=0, antialiased=False) ax.set_zlim3d(-1.01, 1.01) -#ax.w_zaxis.set_major_locator(LinearLocator(10)) -#ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f')) +#ax.zaxis.set_major_locator(LinearLocator(10)) +#ax.zaxis.set_major_formatter(FormatStrFormatter('%.03f')) fig.colorbar(surf, shrink=0.5, aspect=5) diff --git a/lib/matplotlib/cbook/deprecation.py b/lib/matplotlib/cbook/deprecation.py index a5a8ab7312b5..35b835a0357a 100644 --- a/lib/matplotlib/cbook/deprecation.py +++ b/lib/matplotlib/cbook/deprecation.py @@ -24,16 +24,16 @@ class MatplotlibDeprecationWarning(UserWarning): def _generate_deprecation_warning( since, message='', name='', alternative='', pending=False, obj_type='attribute', addendum='', *, removal=''): - - if removal == "": - removal = {"2.2": "in 3.1", "3.0": "in 3.2", "3.1": "in 3.3"}.get( - since, "two minor releases later") - elif removal: - if pending: + if pending: + if removal: raise ValueError( "A pending deprecation cannot have a scheduled removal") - removal = "in {}".format(removal) - + else: + if removal: + removal = "in {}".format(removal) + else: + removal = {"2.2": "in 3.1", "3.0": "in 3.2", "3.1": "in 3.3"}.get( + since, "two minor releases later") if not message: message = ( "\nThe %(name)s %(obj_type)s" @@ -46,10 +46,8 @@ def _generate_deprecation_warning( + "." + (" Use %(alternative)s instead." if alternative else "") + (" %(addendum)s" if addendum else "")) - warning_cls = (PendingDeprecationWarning if pending else MatplotlibDeprecationWarning) - return warning_cls(message % dict( func=name, name=name, obj_type=obj_type, since=since, removal=removal, alternative=alternative, addendum=addendum)) diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index ccf658bbc72d..33a08816cf69 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -205,11 +205,6 @@ def _init_axis(self): self.xy_dataLim.intervaly, self) self.zaxis = axis3d.ZAxis('z', self.zz_viewLim.intervalx, self.zz_dataLim.intervalx, self) - # Provide old aliases - self.w_xaxis = self.xaxis - self.w_yaxis = self.yaxis - self.w_zaxis = self.zaxis - for ax in self.xaxis, self.yaxis, self.zaxis: ax.init3d() @@ -217,6 +212,21 @@ def get_zaxis(self): '''Return the ``ZAxis`` (`~.axis3d.Axis`) instance.''' return self.zaxis + @cbook.deprecated("3.1", alternative="xaxis", pending=True) + @property + def w_xaxis(self): + return self.xaxis + + @cbook.deprecated("3.1", alternative="yaxis", pending=True) + @property + def w_yaxis(self): + return self.yaxis + + @cbook.deprecated("3.1", alternative="zaxis", pending=True) + @property + def w_zaxis(self): + return self.zaxis + def _get_axis_list(self): return super()._get_axis_list() + (self.zaxis, )
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: