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

Skip to content

Added axes inversion to cla() #8455

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 14 commits into from
Apr 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added tests
  • Loading branch information
jrmlhermitte authored and Julien L committed Apr 14, 2017
commit 64f80e6e1cbfa7793824e500645689ffd1adb216
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def test_inverted_cla():
assert ax.yaxis_inverted()

# 5. two shared axes. Clearing the master axis should bring axes in shared
# axies back to normal
# axes back to normal
ax0 = plt.subplot(211)
ax1 = plt.subplot(212, sharey=ax0)
ax0.imshow(img)
Expand Down
20 changes: 20 additions & 0 deletions lib/mpl_toolkits/tests/test_mplot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,3 +564,23 @@ def test_invalid_axes_limits(setter, side, value):
obj = fig.add_subplot(111, projection='3d')
with pytest.raises(ValueError):
getattr(obj, setter)(**limit)


def test_inverted_cla():
# Github PR #5450. Setting autoscale should reset
# axes to be non-inverted.
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
# 1. test that a new axis is not inverted per default
assert not ax.xaxis_inverted()
assert not ax.yaxis_inverted()
assert not ax.zaxis_inverted()
ax.set_xlim(1, 0)
ax.set_ylim(1, 0)
ax.set_zlim(1, 0)
assert ax.xaxis_inverted()
assert ax.yaxis_inverted()
assert ax.zaxis_inverted()
ax.cla()
assert not ax.xaxis_inverted()
assert not ax.yaxis_inverted()
assert not ax.zaxis_inverted()