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

Skip to content

Commit 9ab5aad

Browse files
authored
Merge pull request #22366 from oscargus/axes3ddeprecations
Deprecation removal/updates in axes3d
2 parents 2b4b44e + 07a831c commit 9ab5aad

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ def __init__(
9696
does not produce the desired result. Note however, that a manual
9797
zorder will only be correct for a limited view angle. If the figure
9898
is rotated by the user, it will look wrong from certain angles.
99-
auto_add_to_figure : bool, default: True
99+
auto_add_to_figure : bool, default: False
100100
Prior to Matplotlib 3.4 Axes3D would add themselves
101101
to their host Figure on init. Other Axes class do not
102102
do this.
103103
104-
This behavior is deprecated in 3.4, the default will
105-
change to False in 3.5. The keyword will be undocumented
106-
and a non-False value will be an error in 3.6.
104+
This behavior is deprecated in 3.4, the default is
105+
changed to False in 3.6. The keyword will be undocumented
106+
and a non-False value will be an error in 3.7.
107107
focal_length : float, default: None
108108
For a projection type of 'persp', the focal length of the virtual
109109
camera. Must be > 0. If None, defaults to 1.
@@ -142,7 +142,7 @@ def __init__(
142142
self._shared_axes["z"].join(self, sharez)
143143
self._adjustable = 'datalim'
144144

145-
auto_add_to_figure = kwargs.pop('auto_add_to_figure', True)
145+
auto_add_to_figure = kwargs.pop('auto_add_to_figure', False)
146146

147147
super().__init__(
148148
fig, rect, frameon=True, box_aspect=box_aspect, *args, **kwargs
@@ -176,12 +176,12 @@ def __init__(
176176

177177
if auto_add_to_figure:
178178
_api.warn_deprecated(
179-
"3.4", removal="3.6", message="Axes3D(fig) adding itself "
179+
"3.4", removal="3.7", message="Axes3D(fig) adding itself "
180180
"to the figure is deprecated since %(since)s. "
181181
"Pass the keyword argument auto_add_to_figure=False "
182182
"and use fig.add_axes(ax) to suppress this warning. "
183-
"The default value of auto_add_to_figure will change to "
184-
"False in mpl3.5 and True values will "
183+
"The default value of auto_add_to_figure is changed to "
184+
"False in mpl3.6 and True values will "
185185
"no longer work %(removal)s. This is consistent with "
186186
"other Axes classes.")
187187
fig.add_axes(self)
@@ -1433,12 +1433,7 @@ def plot_surface(self, X, Y, Z, *, norm=None, vmin=None,
14331433
cmap = kwargs.get('cmap', None)
14341434
shade = kwargs.pop('shade', cmap is None)
14351435
if shade is None:
1436-
_api.warn_deprecated(
1437-
"3.1",
1438-
message="Passing shade=None to Axes3D.plot_surface() is "
1439-
"deprecated since matplotlib 3.1 and will change its "
1440-
"semantic or raise an error in matplotlib 3.3. "
1441-
"Please use shade=False instead.")
1436+
raise ValueError("shade cannot be None.")
14421437

14431438
colset = [] # the sampled facecolor
14441439
if (rows - 1) % rstride == 0 and \

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from mpl_toolkits.mplot3d import Axes3D, axes3d, proj3d, art3d
77
import matplotlib as mpl
88
from matplotlib.backend_bases import MouseButton
9-
from matplotlib.cbook import MatplotlibDeprecationWarning
109
from matplotlib import cm
1110
from matplotlib import colors as mcolors
1211
from matplotlib.testing.decorators import image_comparison, check_figures_equal
@@ -1266,8 +1265,7 @@ def test_inverted_cla():
12661265

12671266
def test_ax3d_tickcolour():
12681267
fig = plt.figure()
1269-
with pytest.warns(MatplotlibDeprecationWarning):
1270-
ax = Axes3D(fig)
1268+
ax = Axes3D(fig)
12711269

12721270
ax.tick_params(axis='x', colors='red')
12731271
ax.tick_params(axis='y', colors='red')

0 commit comments

Comments
 (0)