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

Skip to content

Commit f2e0479

Browse files
authored
Merge pull request #11387 from anntzer/worldaxis
Deprecate Axes3D.w_{x,y,z}axis in favor of .{x,y,z}axis.
2 parents 093d582 + f853c99 commit f2e0479

File tree

5 files changed

+31
-18
lines changed

5 files changed

+31
-18
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecations
2+
````````````
3+
4+
``axes3d.Axes3D.w_xaxis``, ``.w_yaxis``, and ``.w_zaxis`` are deprecated (use
5+
``.xaxis``, ``.yaxis``, and ``.zaxis`` instead).

examples/mplot3d/surface3d_3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@
3636

3737
# Customize the z axis.
3838
ax.set_zlim(-1, 1)
39-
ax.w_zaxis.set_major_locator(LinearLocator(6))
39+
ax.zaxis.set_major_locator(LinearLocator(6))
4040

4141
plt.show()

examples/pyplots/whats_new_1_subplot3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
linewidth=0, antialiased=False)
2424
ax.set_zlim3d(-1.01, 1.01)
2525

26-
#ax.w_zaxis.set_major_locator(LinearLocator(10))
27-
#ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f'))
26+
#ax.zaxis.set_major_locator(LinearLocator(10))
27+
#ax.zaxis.set_major_formatter(FormatStrFormatter('%.03f'))
2828

2929
fig.colorbar(surf, shrink=0.5, aspect=5)
3030

lib/matplotlib/cbook/deprecation.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ class MatplotlibDeprecationWarning(UserWarning):
2424
def _generate_deprecation_warning(
2525
since, message='', name='', alternative='', pending=False,
2626
obj_type='attribute', addendum='', *, removal=''):
27-
28-
if removal == "":
29-
removal = {"2.2": "in 3.1", "3.0": "in 3.2", "3.1": "in 3.3"}.get(
30-
since, "two minor releases later")
31-
elif removal:
32-
if pending:
27+
if pending:
28+
if removal:
3329
raise ValueError(
3430
"A pending deprecation cannot have a scheduled removal")
35-
removal = "in {}".format(removal)
36-
31+
else:
32+
if removal:
33+
removal = "in {}".format(removal)
34+
else:
35+
removal = {"2.2": "in 3.1", "3.0": "in 3.2", "3.1": "in 3.3"}.get(
36+
since, "two minor releases later")
3737
if not message:
3838
message = (
3939
"\nThe %(name)s %(obj_type)s"
@@ -46,10 +46,8 @@ def _generate_deprecation_warning(
4646
+ "."
4747
+ (" Use %(alternative)s instead." if alternative else "")
4848
+ (" %(addendum)s" if addendum else ""))
49-
5049
warning_cls = (PendingDeprecationWarning if pending
5150
else MatplotlibDeprecationWarning)
52-
5351
return warning_cls(message % dict(
5452
func=name, name=name, obj_type=obj_type, since=since, removal=removal,
5553
alternative=alternative, addendum=addendum))

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,28 @@ def _init_axis(self):
205205
self.xy_dataLim.intervaly, self)
206206
self.zaxis = axis3d.ZAxis('z', self.zz_viewLim.intervalx,
207207
self.zz_dataLim.intervalx, self)
208-
# Provide old aliases
209-
self.w_xaxis = self.xaxis
210-
self.w_yaxis = self.yaxis
211-
self.w_zaxis = self.zaxis
212-
213208
for ax in self.xaxis, self.yaxis, self.zaxis:
214209
ax.init3d()
215210

216211
def get_zaxis(self):
217212
'''Return the ``ZAxis`` (`~.axis3d.Axis`) instance.'''
218213
return self.zaxis
219214

215+
@cbook.deprecated("3.1", alternative="xaxis", pending=True)
216+
@property
217+
def w_xaxis(self):
218+
return self.xaxis
219+
220+
@cbook.deprecated("3.1", alternative="yaxis", pending=True)
221+
@property
222+
def w_yaxis(self):
223+
return self.yaxis
224+
225+
@cbook.deprecated("3.1", alternative="zaxis", pending=True)
226+
@property
227+
def w_zaxis(self):
228+
return self.zaxis
229+
220230
def _get_axis_list(self):
221231
return super()._get_axis_list() + (self.zaxis, )
222232

0 commit comments

Comments
 (0)