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
Prev Previous commit
Next Next commit
PEP8 fixes to test_axes.py
  • Loading branch information
jrmlhermitte authored and Julien L committed Apr 14, 2017
commit ab0d228ce377d3874b7456ab5874642d376627fc
16 changes: 9 additions & 7 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,24 +177,25 @@ def test_twin_inherit_autoscale_setting():
assert ax_y_on.get_autoscaley_on()
assert not ax_y_off.get_autoscaley_on()


@cleanup
def test_inverted_cla():
# Github PR #5450. Setting autoscale should reset
# Github PR #5450. Setting autoscale should reset
# axes to be non-inverted.
# plotting an image, then 1d graph, axis is now down
fig = plt.figure(0);
fig = plt.figure(0)
ax = fig.gca()
# test that a new axis is not inverted per default
assert not(ax.xaxis_inverted())
assert not(ax.yaxis_inverted())
img = np.random.random((100,100))
img = np.random.random((100, 100))
ax.imshow(img)
# test that a image axis is inverted
assert not(ax.xaxis_inverted())
assert ax.yaxis_inverted()
ax.cla()
x = np.linspace(0,2*np.pi,100);
ax.plot(x,np.cos(x))
x = np.linspace(0, 2*np.pi, 100)
ax.plot(x, np.cos(x))
assert not(ax.xaxis_inverted())
assert not(ax.yaxis_inverted())

Expand All @@ -210,13 +211,13 @@ def test_inverted_cla():
ax0 = plt.subplot(211)
ax1 = plt.subplot(212, sharey=ax0)
ax0.imshow(img)
ax1.plot(x,np.cos(x))
ax1.plot(x, np.cos(x))
ax0.cla()
assert not(ax1.yaxis_inverted())
ax1.cla()
# clearing the nonmaster should not touch limits
ax0.imshow(img)
ax1.plot(x,np.cos(x))
ax1.plot(x, np.cos(x))
ax1.cla()
assert ax.yaxis_inverted()

Expand Down Expand Up @@ -2148,6 +2149,7 @@ def test_boxplot_autorange_whiskers():
ax2.set_ylim((-5, 5))



def _rc_test_bxp_helper(ax, rc_dict):
x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
Expand Down