File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1737,6 +1737,32 @@ def test_empty_shared_subplots():
1737
1737
assert y1 >= 6
1738
1738
1739
1739
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
+
1740
1766
if __name__ == '__main__' :
1741
1767
import nose
1742
1768
nose .runmodule (argv = ['-s' , '--with-doctest' ], exit = False )
You can’t perform that action at this time.
0 commit comments