Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c66c423

Browse filesBrowse files
authored
Merge pull request #9793 from tacaswell/fix_none_zorder
FIX: treat `zorder=None` as falling back to the default
2 parents 5ec960b + ed02d72 commit c66c423
Copy full SHA for c66c423

File tree

Expand file treeCollapse file tree

2 files changed

+12
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-0
lines changed

‎lib/matplotlib/artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/artist.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ def set_zorder(self, level):
885885
886886
ACCEPTS: any number
887887
"""
888+
if level is None:
889+
level = self.__class__.zorder
888890
self.zorder = level
889891
self.pchanged()
890892
self.stale = True

‎lib/matplotlib/tests/test_artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_artist.py
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,13 @@ def test_setp():
246246
sio = io.StringIO()
247247
plt.setp(lines1, 'zorder', file=sio)
248248
assert sio.getvalue() == ' zorder: any number \n'
249+
250+
251+
def test_None_zorder():
252+
fig, ax = plt.subplots()
253+
ln, = ax.plot(range(5), zorder=None)
254+
assert ln.get_zorder() == mlines.Line2D.zorder
255+
ln.set_zorder(123456)
256+
assert ln.get_zorder() == 123456
257+
ln.set_zorder(None)
258+
assert ln.get_zorder() == mlines.Line2D.zorder

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.