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

Skip to content

Deprecation removal/updates in axes3d #22366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 \
Expand Down
4 changes: 1 addition & 3 deletions lib/mpl_toolkits/tests/test_mplot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down