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

FIX: treat zorder=None as falling back to the default #9793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
FIX: treat zorder=None as falling back to the default
closes #9785
  • Loading branch information
tacaswell committed Nov 16, 2017
commit ed02d72e92102b92072216cb3f05bc0b9ad4ccad
2 changes: 2 additions & 0 deletions 2 lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,8 @@ def set_zorder(self, level):

ACCEPTS: any number
"""
if level is None:
level = self.__class__.zorder
self.zorder = level
self.pchanged()
self.stale = True
Expand Down
10 changes: 10 additions & 0 deletions 10 lib/matplotlib/tests/test_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,13 @@ def test_setp():
sio = io.StringIO()
plt.setp(lines1, 'zorder', file=sio)
assert sio.getvalue() == ' zorder: any number \n'


def test_None_zorder():
fig, ax = plt.subplots()
ln, = ax.plot(range(5), zorder=None)
assert ln.get_zorder() == mlines.Line2D.zorder
ln.set_zorder(123456)
assert ln.get_zorder() == 123456
ln.set_zorder(None)
assert ln.get_zorder() == mlines.Line2D.zorder
Morty Proxy This is a proxified and sanitized view of the page, visit original site.