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

Skip to content

Commit 0e51daf

Browse files
committed
TST: test that get_position gives new axes position if diff aspect
1 parent 0b80a41 commit 0e51daf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import matplotlib.markers as mmarkers
2626
import matplotlib.patches as mpatches
2727
import matplotlib.colors as mcolors
28-
from numpy.testing import assert_allclose, assert_array_equal
28+
from numpy.testing import (
29+
assert_allclose, assert_array_equal, assert_array_almost_equal)
2930
from matplotlib.cbook import (
3031
IgnoredKeywordWarning, MatplotlibDeprecationWarning)
3132
from matplotlib.cbook._backports import broadcast_to
@@ -4821,8 +4822,16 @@ def test_square_plot():
48214822
ax.plot(x, y, 'mo')
48224823
ax.axis('square')
48234824
xlim, ylim = ax.get_xlim(), ax.get_ylim()
4825+
print(ax.get_position(original=True).extents)
4826+
print(ax.get_position(original=False).extents)
48244827
assert np.diff(xlim) == np.diff(ylim)
48254828
assert ax.get_aspect() == 'equal'
4829+
assert_array_almost_equal(
4830+
ax.get_position(original=True).extents,
4831+
np.array((0.125, 0.1, 0.9, 0.9)))
4832+
assert_array_almost_equal(
4833+
ax.get_position(original=False).extents,
4834+
np.array((0.2125, 0.1, 0.8125, 0.9)))
48264835

48274836

48284837
def test_no_None():

0 commit comments

Comments
 (0)