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

Skip to content

Commit acdc256

Browse files
committed
Deprecate unit_cube-related methods in Axes3D
1 parent 231d1c8 commit acdc256

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
``unit_cube``, ``tunit_cube``, and ``tunit_edges``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... of `.Axes3D` are deprecated without replacements. If you rely on them,
5+
please copy the code of the corresponding private function (name starting
6+
with ``_``).

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ def get_zaxis(self):
236236
w_zaxis = _api.deprecated("3.1", alternative="zaxis", removal="3.8")(
237237
property(lambda self: self.zaxis))
238238

239+
@_api.deprecated("3.7")
239240
def unit_cube(self, vals=None):
241+
return self._unit_cube(vals)
242+
243+
def _unit_cube(self, vals=None):
240244
minx, maxx, miny, maxy, minz, maxz = vals or self.get_w_lims()
241245
return [(minx, miny, minz),
242246
(maxx, miny, minz),
@@ -247,15 +251,23 @@ def unit_cube(self, vals=None):
247251
(maxx, maxy, maxz),
248252
(minx, maxy, maxz)]
249253

254+
@_api.deprecated("3.7")
250255
def tunit_cube(self, vals=None, M=None):
256+
return self._tunit_cube(vals, M)
257+
258+
def _tunit_cube(self, vals=None, M=None):
251259
if M is None:
252260
M = self.M
253-
xyzs = self.unit_cube(vals)
261+
xyzs = self._unit_cube(vals)
254262
tcube = proj3d.proj_points(xyzs, M)
255263
return tcube
256264

265+
@_api.deprecated("3.7")
257266
def tunit_edges(self, vals=None, M=None):
258-
tc = self.tunit_cube(vals, M)
267+
return self._tunit_edges(vals, M)
268+
269+
def _tunit_edges(self, vals=None, M=None):
270+
tc = self._tunit_cube(vals, M)
259271
edges = [(tc[0], tc[1]),
260272
(tc[1], tc[2]),
261273
(tc[2], tc[3]),
@@ -496,7 +508,7 @@ def draw(self, renderer):
496508

497509
def get_axis_position(self):
498510
vals = self.get_w_lims()
499-
tc = self.tunit_cube(vals, self.M)
511+
tc = self._tunit_cube(vals, self.M)
500512
xhigh = tc[1][2] > tc[2][2]
501513
yhigh = tc[3][2] > tc[2][2]
502514
zhigh = tc[0][2] > tc[2][2]
@@ -1063,7 +1075,7 @@ def format_coord(self, xd, yd):
10631075
).replace("-", "\N{MINUS SIGN}")
10641076

10651077
# nearest edge
1066-
p0, p1 = min(self.tunit_edges(),
1078+
p0, p1 = min(self._tunit_edges(),
10671079
key=lambda edge: proj3d._line2d_seg_dist(
10681080
edge[0], edge[1], (xd, yd)))
10691081

lib/mpl_toolkits/mplot3d/axis3d.py

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

258258
# Project the bounds along the current position of the cube:
259259
bounds = mins[0], maxs[0], mins[1], maxs[1], mins[2], maxs[2]
260-
bounds_proj = self.axes.tunit_cube(bounds, self.axes.M)
260+
bounds_proj = self.axes._tunit_cube(bounds, self.axes.M)
261261

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

0 commit comments

Comments
 (0)