Skip to content

Commit 94bdfd6

Browse files
committed
Adding test test_relim_visible_only
1 parent 132a463 commit 94bdfd6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/matplotlib/tests/test_axes.py

+26
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,32 @@ def test_empty_shared_subplots():
17371737
assert y1 >= 6
17381738

17391739

1740+
@cleanup
1741+
def test_relim_visible_only():
1742+
x1 = (0., 10.)
1743+
y1 = (0., 10.)
1744+
x2 = (-10., 20.)
1745+
y2 = (-10., 30.)
1746+
1747+
fig = matplotlib.figure.Figure()
1748+
ax = fig.add_subplot(111)
1749+
ax.plot(x1, y1)
1750+
assert ax.get_xlim() == x1
1751+
assert ax.get_ylim() == y1
1752+
l = ax.plot(x2, y2)
1753+
assert ax.get_xlim() == x2
1754+
assert ax.get_ylim() == y2
1755+
l[0].set_visible(False)
1756+
assert ax.get_xlim() == x2
1757+
assert ax.get_ylim() == y2
1758+
1759+
ax.relim(visible_only=True)
1760+
ax.autoscale_view()
1761+
1762+
assert ax.get_xlim() == x1
1763+
assert ax.get_ylim() == y1
1764+
1765+
17401766
if __name__ == '__main__':
17411767
import nose
17421768
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)