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

Skip to content

Commit aa36ec3

Browse files
committed
test for shared log axes
1 parent a8e7575 commit aa36ec3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,25 @@ def test_autoscale_tight():
176176
assert_allclose(ax.get_xlim(), (-0.15, 3.15))
177177
assert_allclose(ax.get_ylim(), (1.0, 4.0))
178178

179+
180+
@cleanup(style='default')
181+
def test_autoscale_log_shared():
182+
# related to github #7587
183+
# array starts at zero to trigger _minpos handling
184+
x = np.arange(100, dtype=float)
185+
fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
186+
ax1.loglog(x, x)
187+
ax2.semilogx(x, x)
188+
ax1.autoscale(tight=True)
189+
ax2.autoscale(tight=True)
190+
plt.draw()
191+
lims = (x[1], x[-1])
192+
assert_allclose(ax1.get_xlim(), lims)
193+
assert_allclose(ax1.get_ylim(), lims)
194+
assert_allclose(ax2.get_xlim(), lims)
195+
assert_allclose(ax2.get_ylim(), (x[0], x[-1]))
196+
197+
179198
@cleanup(style='default')
180199
def test_use_sticky_edges():
181200
fig, ax = plt.subplots()

0 commit comments

Comments
 (0)