diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index 84bbd763f882..da3d7906e2c0 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -225,9 +225,10 @@ 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), @@ -235,31 +236,7 @@ def _unit_cube(self, vals=None): (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): """ @@ -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] diff --git a/lib/mpl_toolkits/mplot3d/axis3d.py b/lib/mpl_toolkits/mplot3d/axis3d.py index dea831582288..7b738b705c2a 100644 --- a/lib/mpl_toolkits/mplot3d/axis3d.py +++ b/lib/mpl_toolkits/mplot3d/axis3d.py @@ -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)