Skip to content

Add a get_zaxis method for 3d axes. #11385

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
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
30 changes: 17 additions & 13 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,24 @@ def set_top_view(self):

def _init_axis(self):
'''Init 3D axes; overrides creation of regular X/Y axes'''
self.w_xaxis = axis3d.XAxis('x', self.xy_viewLim.intervalx,
self.xy_dataLim.intervalx, self)
self.xaxis = self.w_xaxis
self.w_yaxis = axis3d.YAxis('y', self.xy_viewLim.intervaly,
self.xy_dataLim.intervaly, self)
self.yaxis = self.w_yaxis
self.w_zaxis = axis3d.ZAxis('z', self.zz_viewLim.intervalx,
self.zz_dataLim.intervalx, self)
self.zaxis = self.w_zaxis
self.xaxis = axis3d.XAxis('x', self.xy_viewLim.intervalx,
self.xy_dataLim.intervalx, self)
self.yaxis = axis3d.YAxis('y', self.xy_viewLim.intervaly,
self.xy_dataLim.intervaly, self)
self.zaxis = axis3d.ZAxis('z', self.zz_viewLim.intervalx,
self.zz_dataLim.intervalx, self)
# Provide old aliases
self.w_xaxis = self.xaxis
self.w_yaxis = self.yaxis
self.w_zaxis = self.zaxis

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

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

def _get_axis_list(self):
return super()._get_axis_list() + (self.zaxis, )

Expand Down Expand Up @@ -2446,20 +2451,19 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None,
6. +X

zsort : str, optional
The z-axis sorting scheme passed onto
:func:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`
The z-axis sorting scheme passed onto `~.art3d.Poly3DCollection`

shade : bool, optional (default = True)
When true, this shades the dark sides of the bars (relative
to the plot's source of light).

**kwargs
Any additional keyword arguments are passed onto
:class:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`
`~.art3d.Poly3DCollection`.

Returns
-------
collection : Poly3DCollection
collection : `~.art3d.Poly3DCollection`
A collection of three dimensional polygons representing
the bars.
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/mpl_toolkits/mplot3d/axis3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def tick_update_position(tick, tickxs, tickys, labelpos):


class Axis(maxis.XAxis):

"""An Axis class for the 3D plots. """
# These points from the unit cube make up the x, y and z-planes
_PLANES = (
(0, 3, 7, 4), (1, 2, 6, 5), # yz planes
Expand Down