From d5681db097165302902d37c4993c846937294df5 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Mon, 31 Jan 2022 14:45:54 +0100 Subject: [PATCH 1/2] Remove support for shade=None --- lib/mpl_toolkits/mplot3d/axes3d.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index 2d046bf1ae96..51a561471a23 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -1617,12 +1617,7 @@ def plot_surface(self, X, Y, Z, *, norm=None, vmin=None, cmap = kwargs.get('cmap', None) shade = kwargs.pop('shade', cmap is None) if shade is None: - _api.warn_deprecated( - "3.1", - message="Passing shade=None to Axes3D.plot_surface() is " - "deprecated since matplotlib 3.1 and will change its " - "semantic or raise an error in matplotlib 3.3. " - "Please use shade=False instead.") + raise ValueError("shade cannot be None.") colset = [] # the sampled facecolor if (rows - 1) % rstride == 0 and \ From 07a831cba7f6628aa52c7f43eb3b0a2573296346 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Mon, 31 Jan 2022 14:47:13 +0100 Subject: [PATCH 2/2] Change default of auto_add_to_figure --- lib/mpl_toolkits/mplot3d/axes3d.py | 16 ++++++++-------- lib/mpl_toolkits/tests/test_mplot3d.py | 4 +--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index 51a561471a23..ca713de4cee1 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -96,14 +96,14 @@ def __init__( does not produce the desired result. Note however, that a manual zorder will only be correct for a limited view angle. If the figure is rotated by the user, it will look wrong from certain angles. - auto_add_to_figure : bool, default: True + auto_add_to_figure : bool, default: False Prior to Matplotlib 3.4 Axes3D would add themselves to their host Figure on init. Other Axes class do not do this. - This behavior is deprecated in 3.4, the default will - change to False in 3.5. The keyword will be undocumented - and a non-False value will be an error in 3.6. + This behavior is deprecated in 3.4, the default is + changed to False in 3.6. The keyword will be undocumented + and a non-False value will be an error in 3.7. focal_length : float, default: None For a projection type of 'persp', the focal length of the virtual camera. Must be > 0. If None, defaults to 1. @@ -142,7 +142,7 @@ def __init__( self._shared_axes["z"].join(self, sharez) self._adjustable = 'datalim' - auto_add_to_figure = kwargs.pop('auto_add_to_figure', True) + auto_add_to_figure = kwargs.pop('auto_add_to_figure', False) super().__init__( fig, rect, frameon=True, box_aspect=box_aspect, *args, **kwargs @@ -178,12 +178,12 @@ def __init__( if auto_add_to_figure: _api.warn_deprecated( - "3.4", removal="3.6", message="Axes3D(fig) adding itself " + "3.4", removal="3.7", message="Axes3D(fig) adding itself " "to the figure is deprecated since %(since)s. " "Pass the keyword argument auto_add_to_figure=False " "and use fig.add_axes(ax) to suppress this warning. " - "The default value of auto_add_to_figure will change to " - "False in mpl3.5 and True values will " + "The default value of auto_add_to_figure is changed to " + "False in mpl3.6 and True values will " "no longer work %(removal)s. This is consistent with " "other Axes classes.") fig.add_axes(self) diff --git a/lib/mpl_toolkits/tests/test_mplot3d.py b/lib/mpl_toolkits/tests/test_mplot3d.py index 0c1682132380..543816f9b9dd 100644 --- a/lib/mpl_toolkits/tests/test_mplot3d.py +++ b/lib/mpl_toolkits/tests/test_mplot3d.py @@ -6,7 +6,6 @@ from mpl_toolkits.mplot3d import Axes3D, axes3d, proj3d, art3d import matplotlib as mpl from matplotlib.backend_bases import MouseButton -from matplotlib.cbook import MatplotlibDeprecationWarning from matplotlib import cm from matplotlib import colors as mcolors from matplotlib.testing.decorators import image_comparison, check_figures_equal @@ -1266,8 +1265,7 @@ def test_inverted_cla(): def test_ax3d_tickcolour(): fig = plt.figure() - with pytest.warns(MatplotlibDeprecationWarning): - ax = Axes3D(fig) + ax = Axes3D(fig) ax.tick_params(axis='x', colors='red') ax.tick_params(axis='y', colors='red')