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

Skip to content

Cleanup unit_cube-methods #27452

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 1 commit into from
Dec 7, 2023
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
36 changes: 6 additions & 30 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,41 +225,18 @@ def get_zaxis(self):
get_zgridlines = _axis_method_wrapper("zaxis", "get_gridlines")
get_zticklines = _axis_method_wrapper("zaxis", "get_ticklines")

def _unit_cube(self, vals=None):
minx, maxx, miny, maxy, minz, maxz = vals or self.get_w_lims()
return [(minx, miny, minz),
def _transformed_cube(self, vals):
"""Return cube with limits from *vals* transformed by self.M."""
minx, maxx, miny, maxy, minz, maxz = vals
xyzs = [(minx, miny, minz),
(maxx, miny, minz),
(maxx, maxy, minz),
(minx, maxy, minz),
(minx, miny, maxz),
(maxx, miny, maxz),
(maxx, maxy, maxz),
(minx, maxy, maxz)]

def _tunit_cube(self, vals=None, M=None):
if M is None:
M = self.M
xyzs = self._unit_cube(vals)
tcube = proj3d._proj_points(xyzs, M)
return tcube

def _tunit_edges(self, vals=None, M=None):
tc = self._tunit_cube(vals, M)
edges = [(tc[0], tc[1]),
(tc[1], tc[2]),
(tc[2], tc[3]),
(tc[3], tc[0]),

(tc[0], tc[4]),
(tc[1], tc[5]),
(tc[2], tc[6]),
(tc[3], tc[7]),

(tc[4], tc[5]),
(tc[5], tc[6]),
(tc[6], tc[7]),
(tc[7], tc[4])]
return edges
return proj3d._proj_points(xyzs, self.M)

def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
"""
Expand Down Expand Up @@ -487,8 +464,7 @@ def draw(self, renderer):
super().draw(renderer)

def get_axis_position(self):
vals = self.get_w_lims()
tc = self._tunit_cube(vals, self.M)
tc = self._transformed_cube(self.get_w_lims())
xhigh = tc[1][2] > tc[2][2]
yhigh = tc[3][2] > tc[2][2]
zhigh = tc[0][2] > tc[2][2]
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 @@ -285,7 +285,7 @@ def _get_coord_info(self):

# Project the bounds along the current position of the cube:
bounds = mins[0], maxs[0], mins[1], maxs[1], mins[2], maxs[2]
bounds_proj = self.axes._tunit_cube(bounds, self.axes.M)
bounds_proj = self.axes._transformed_cube(bounds)

# Determine which one of the parallel planes are higher up:
means_z0 = np.zeros(3)
Expand Down