@@ -26,16 +26,13 @@ def check_shared(axs, x_shared, y_shared):
2626
2727
2828def check_visible (axs , x_visible , y_visible ):
29- def tostr (v ):
30- return "invisible" if v else "visible"
31-
32- for ax , vx , vy in zip (axs , x_visible , y_visible ):
29+ for i , (ax , vx , vy ) in enumerate (zip (axs , x_visible , y_visible )):
3330 for l in ax .get_xticklabels () + [ax .get_xaxis ().offsetText ]:
3431 assert l .get_visible () == vx , \
35- "X axis was incorrectly %s" % ( tostr ( vx ))
32+ f"Visibility of x axis # { i } is incorrectly { vx } "
3633 for l in ax .get_yticklabels () + [ax .get_yaxis ().offsetText ]:
3734 assert l .get_visible () == vy , \
38- "Y axis was incorrectly %s" % ( tostr ( vy ))
35+ f"Visibility of y axis # { i } is incorrectly { vy } "
3936
4037
4138def test_shared ():
@@ -99,6 +96,26 @@ def test_shared():
9996 check_visible (axs , [False , False , True , True ], [True , False , True , False ])
10097
10198
99+ def test_label_outer_span ():
100+ fig = plt .figure ()
101+ gs = fig .add_gridspec (3 , 3 )
102+ # +---+---+---+
103+ # | 1 | |
104+ # +---+---+---+
105+ # | | | 3 |
106+ # + 2 +---+---+
107+ # | | 4 | |
108+ # +---+---+---+
109+ a1 = fig .add_subplot (gs [0 , 0 :2 ])
110+ a2 = fig .add_subplot (gs [1 :3 , 0 ])
111+ a3 = fig .add_subplot (gs [1 , 2 ])
112+ a4 = fig .add_subplot (gs [2 , 1 ])
113+ for ax in fig .axes :
114+ ax .label_outer ()
115+ check_visible (
116+ fig .axes , [False , True , False , True ], [True , True , False , False ])
117+
118+
102119def test_shared_and_moved ():
103120 # test if sharey is on, but then tick_left is called that labels don't
104121 # re-appear. Seaborn does this just to be sure yaxis is on left...
0 commit comments