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

Skip to content

Commit 61451ee

Browse files
KentKent
Kent
authored and
Kent
committed
Change kwarg to computed_zorder
1 parent 4de1eb4 commit 61451ee

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Axes3D(Axes):
4949
def __init__(
5050
self, fig, rect=None, *args,
5151
azim=-60, elev=30, sharez=None, proj_type='persp',
52-
box_aspect=None, force_zorder=False,
52+
box_aspect=None, computed_zorder=True,
5353
**kwargs):
5454
"""
5555
Parameters
@@ -66,10 +66,10 @@ def __init__(
6666
Other axes to share z-limits with.
6767
proj_type : {'persp', 'ortho'}
6868
The projection type, default 'persp'.
69-
force_zorder : bool, optional
70-
Force use of each collection and patch's zorder to determine
71-
draw order. If this option is True, automatic draw order is
72-
completely disabled. Defaults to False.
69+
computed_zorder : bool, optional
70+
If this option is True, draw order is computed automatically.
71+
Otherwise, each collection and patch's zorder is used to determine
72+
draw order. Defaults to True.
7373
auto_add_to_figure : bool, default: True
7474
Prior to Matplotlib 3.4 Axes3D would add themselves
7575
to their host Figure on init. Other Axes class do not
@@ -89,7 +89,7 @@ def __init__(
8989
.. versionadded:: 1.2.1
9090
The *sharez* parameter.
9191
.. versionadded:: TBD
92-
The *force_zorder* parameter.
92+
The *computed_zorder* parameter.
9393
"""
9494

9595
if rect is None:
@@ -98,7 +98,7 @@ def __init__(
9898
self.initial_azim = azim
9999
self.initial_elev = elev
100100
self.set_proj_type(proj_type)
101-
self.force_zorder = force_zorder
101+
self.computed_zorder = computed_zorder
102102

103103
self.xy_viewLim = Bbox.unit()
104104
self.zz_viewLim = Bbox.unit()
@@ -484,26 +484,26 @@ def do_3d_projection(artist):
484484
"%(since)s and will be removed %(removal)s.")
485485
return artist.do_3d_projection(renderer)
486486

487-
if self.force_zorder:
488-
for col in self.collections:
489-
col.do_3d_projection()
490-
for patch in self.patches:
491-
patch.do_3d_projection()
492-
else:
493-
# Calculate projection of collections and patches and zorder them.
494-
# Make sure they are drawn above the grids.
487+
if self.computed_zorder:
488+
# Calculate projection of collections and patches and zorder
489+
# them. Make sure they are drawn above the grids.
495490
zorder_offset = max(axis.get_zorder()
496491
for axis in self._get_axis_list()) + 1
497492
for i, col in enumerate(
498493
sorted(self.collections,
499-
key=do_3d_projection,
500-
reverse=True)):
494+
key=do_3d_projection,
495+
reverse=True)):
501496
col.zorder = zorder_offset + i
502497
for i, patch in enumerate(
503498
sorted(self.patches,
504-
key=do_3d_projection,
505-
reverse=True)):
499+
key=do_3d_projection,
500+
reverse=True)):
506501
patch.zorder = zorder_offset + i
502+
else:
503+
for col in self.collections:
504+
col.do_3d_projection()
505+
for patch in self.patches:
506+
patch.do_3d_projection()
507507

508508
if self._axis3don:
509509
# Draw panes first
@@ -3518,6 +3518,7 @@ def stem(self, x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-',
35183518

35193519
stem3D = stem
35203520

3521+
35213522
docstring.interpd.update(Axes3D_kwdoc=artist.kwdoc(Axes3D))
35223523
docstring.dedent_interpd(Axes3D.__init__)
35233524

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,13 +1427,13 @@ def test_subfigure_simple():
14271427
ax = sf[1].add_subplot(1, 1, 1, projection='3d', label='other')
14281428

14291429

1430-
@image_comparison(baseline_images=['force_zorder'], remove_text=True,
1430+
@image_comparison(baseline_images=['computed_zorder'], remove_text=True,
14311431
extensions=['png'])
1432-
def test_force_zorder():
1432+
def test_computed_zorder():
14331433
fig = plt.figure()
14341434
ax1 = fig.add_subplot(221, projection='3d')
14351435
ax2 = fig.add_subplot(222, projection='3d')
1436-
ax2.force_zorder = True
1436+
ax2.computed_zorder = False
14371437

14381438
# create a horizontal plane
14391439
corners = ((0, 0, 0), (0, 5, 0), (5, 5, 0), (5, 0, 0))
@@ -1456,7 +1456,7 @@ def test_force_zorder():
14561456

14571457
ax3 = fig.add_subplot(223, projection='3d')
14581458
ax4 = fig.add_subplot(224, projection='3d')
1459-
ax4.force_zorder = True
1459+
ax4.computed_zorder = False
14601460

14611461
dim = 10
14621462
X, Y = np.meshgrid((-dim, dim), (-dim, dim))

0 commit comments

Comments
 (0)