Skip to content

Commit 5cdd2e5

Browse files
authored
Merge pull request #11385 from ImportanceOfBeingErnest/get_zaxis_for_3d_plot
Add a get_zaxis method for 3d axes.
2 parents a328dc7 + 664ccc8 commit 5cdd2e5

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,24 @@ def set_top_view(self):
197197

198198
def _init_axis(self):
199199
'''Init 3D axes; overrides creation of regular X/Y axes'''
200-
self.w_xaxis = axis3d.XAxis('x', self.xy_viewLim.intervalx,
201-
self.xy_dataLim.intervalx, self)
202-
self.xaxis = self.w_xaxis
203-
self.w_yaxis = axis3d.YAxis('y', self.xy_viewLim.intervaly,
204-
self.xy_dataLim.intervaly, self)
205-
self.yaxis = self.w_yaxis
206-
self.w_zaxis = axis3d.ZAxis('z', self.zz_viewLim.intervalx,
207-
self.zz_dataLim.intervalx, self)
208-
self.zaxis = self.w_zaxis
200+
self.xaxis = axis3d.XAxis('x', self.xy_viewLim.intervalx,
201+
self.xy_dataLim.intervalx, self)
202+
self.yaxis = axis3d.YAxis('y', self.xy_viewLim.intervaly,
203+
self.xy_dataLim.intervaly, self)
204+
self.zaxis = axis3d.ZAxis('z', self.zz_viewLim.intervalx,
205+
self.zz_dataLim.intervalx, self)
206+
# Provide old aliases
207+
self.w_xaxis = self.xaxis
208+
self.w_yaxis = self.yaxis
209+
self.w_zaxis = self.zaxis
209210

210211
for ax in self.xaxis, self.yaxis, self.zaxis:
211212
ax.init3d()
212213

214+
def get_zaxis(self):
215+
'''Return the ``ZAxis`` (`~.axis3d.Axis`) instance.'''
216+
return self.zaxis
217+
213218
def _get_axis_list(self):
214219
return super()._get_axis_list() + (self.zaxis, )
215220

@@ -2446,20 +2451,19 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None,
24462451
6. +X
24472452
24482453
zsort : str, optional
2449-
The z-axis sorting scheme passed onto
2450-
:func:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`
2454+
The z-axis sorting scheme passed onto `~.art3d.Poly3DCollection`
24512455
24522456
shade : bool, optional (default = True)
24532457
When true, this shades the dark sides of the bars (relative
24542458
to the plot's source of light).
24552459
24562460
**kwargs
24572461
Any additional keyword arguments are passed onto
2458-
:class:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`
2462+
`~.art3d.Poly3DCollection`.
24592463
24602464
Returns
24612465
-------
2462-
collection : Poly3DCollection
2466+
collection : `~.art3d.Poly3DCollection`
24632467
A collection of three dimensional polygons representing
24642468
the bars.
24652469
"""

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def tick_update_position(tick, tickxs, tickys, labelpos):
4545

4646

4747
class Axis(maxis.XAxis):
48-
48+
"""An Axis class for the 3D plots. """
4949
# These points from the unit cube make up the x, y and z-planes
5050
_PLANES = (
5151
(0, 3, 7, 4), (1, 2, 6, 5), # yz planes

0 commit comments

Comments
 (0)