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

Skip to content

Commit 5114f7d

Browse files
committed
TST: secondary_axes resize
1 parent 5cd9676 commit 5114f7d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6106,3 +6106,16 @@ def test_secondary_fail():
61066106
axsec = ax.secondary_xaxis('right')
61076107
with pytest.raises(ValueError):
61086108
axsec = ax.secondary_yaxis('bottom')
6109+
6110+
6111+
def test_secondary_resize():
6112+
fig, ax = plt.subplots(figsize=(10, 5))
6113+
ax.plot(np.arange(2, 11), np.arange(2, 11))
6114+
def invert(x):
6115+
with np.errstate(divide='ignore'):
6116+
return 1 / x
6117+
6118+
axsec = ax.secondary_xaxis('top', functions=(invert, invert))
6119+
fig.canvas.draw()
6120+
fig.set_size_inches((7, 4))
6121+
assert_allclose(ax.get_position().extents, [0.125, 0.1, 0.9 , 0.9 ])

0 commit comments

Comments
 (0)