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

Skip to content

Commit 7ba90fe

Browse files
authored
Merge pull request #27452 from oscargus/unitcube
Cleanup unit_cube-methods
2 parents 302fd39 + ea1b2df commit 7ba90fe

File tree

2 files changed

+7
-31
lines changed

2 files changed

+7
-31
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -225,41 +225,18 @@ def get_zaxis(self):
225225
get_zgridlines = _axis_method_wrapper("zaxis", "get_gridlines")
226226
get_zticklines = _axis_method_wrapper("zaxis", "get_ticklines")
227227

228-
def _unit_cube(self, vals=None):
229-
minx, maxx, miny, maxy, minz, maxz = vals or self.get_w_lims()
230-
return [(minx, miny, minz),
228+
def _transformed_cube(self, vals):
229+
"""Return cube with limits from *vals* transformed by self.M."""
230+
minx, maxx, miny, maxy, minz, maxz = vals
231+
xyzs = [(minx, miny, minz),
231232
(maxx, miny, minz),
232233
(maxx, maxy, minz),
233234
(minx, maxy, minz),
234235
(minx, miny, maxz),
235236
(maxx, miny, maxz),
236237
(maxx, maxy, maxz),
237238
(minx, maxy, maxz)]
238-
239-
def _tunit_cube(self, vals=None, M=None):
240-
if M is None:
241-
M = self.M
242-
xyzs = self._unit_cube(vals)
243-
tcube = proj3d._proj_points(xyzs, M)
244-
return tcube
245-
246-
def _tunit_edges(self, vals=None, M=None):
247-
tc = self._tunit_cube(vals, M)
248-
edges = [(tc[0], tc[1]),
249-
(tc[1], tc[2]),
250-
(tc[2], tc[3]),
251-
(tc[3], tc[0]),
252-
253-
(tc[0], tc[4]),
254-
(tc[1], tc[5]),
255-
(tc[2], tc[6]),
256-
(tc[3], tc[7]),
257-
258-
(tc[4], tc[5]),
259-
(tc[5], tc[6]),
260-
(tc[6], tc[7]),
261-
(tc[7], tc[4])]
262-
return edges
239+
return proj3d._proj_points(xyzs, self.M)
263240

264241
def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
265242
"""
@@ -487,8 +464,7 @@ def draw(self, renderer):
487464
super().draw(renderer)
488465

489466
def get_axis_position(self):
490-
vals = self.get_w_lims()
491-
tc = self._tunit_cube(vals, self.M)
467+
tc = self._transformed_cube(self.get_w_lims())
492468
xhigh = tc[1][2] > tc[2][2]
493469
yhigh = tc[3][2] > tc[2][2]
494470
zhigh = tc[0][2] > tc[2][2]

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def _get_coord_info(self):
285285

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

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

0 commit comments

Comments
 (0)