@@ -279,13 +279,16 @@ def test_colorbar_single_scatter():
279
279
plt .colorbar (cs )
280
280
281
281
282
- @pytest .mark .parametrize ('use_gridspec' , [False , True ],
283
- ids = ['no gridspec' , 'with gridspec' ])
284
- def test_remove_from_figure (use_gridspec ):
285
- """
286
- Test `remove` with the specified ``use_gridspec`` setting
287
- """
288
- fig , ax = plt .subplots ()
282
+ @pytest .mark .parametrize ('use_gridspec' , [True , False ])
283
+ @pytest .mark .parametrize ('nested_gridspecs' , [True , False ])
284
+ def test_remove_from_figure (nested_gridspecs , use_gridspec ):
285
+ """Test `remove` with the specified ``use_gridspec`` setting."""
286
+ fig = plt .figure ()
287
+ if nested_gridspecs :
288
+ gs = fig .add_gridspec (2 , 2 )[1 , 1 ].subgridspec (2 , 2 )
289
+ ax = fig .add_subplot (gs [1 , 1 ])
290
+ else :
291
+ ax = fig .add_subplot ()
289
292
sc = ax .scatter ([1 , 2 ], [3 , 4 ])
290
293
sc .set_array (np .array ([5 , 6 ]))
291
294
pre_position = ax .get_position ()
@@ -298,9 +301,7 @@ def test_remove_from_figure(use_gridspec):
298
301
299
302
300
303
def test_remove_from_figure_cl ():
301
- """
302
- Test `remove` with constrained_layout
303
- """
304
+ """Test `remove` with constrained_layout."""
304
305
fig , ax = plt .subplots (constrained_layout = True )
305
306
sc = ax .scatter ([1 , 2 ], [3 , 4 ])
306
307
sc .set_array (np .array ([5 , 6 ]))
0 commit comments