@@ -310,6 +310,15 @@ def test_label_contour_start():
310310 assert 0 in idxs
311311
312312
313+ def test_clabel_raises_on_filled_contours ():
314+ X , Y = np .meshgrid (np .arange (10 ), np .arange (10 ))
315+ _ , ax = plt .subplots ()
316+ cs = ax .contourf (X , Y , X + Y )
317+ # will be an exception once the deprecation expires
318+ with pytest .warns (mpl .MatplotlibDeprecationWarning ):
319+ ax .clabel (cs )
320+
321+
313322@image_comparison (['contour_corner_mask_False.png' , 'contour_corner_mask_True.png' ],
314323 remove_text = True , tol = 1.88 )
315324def test_corner_mask ():
@@ -359,21 +368,16 @@ def test_clabel_zorder(use_clabeltext, contour_zorder, clabel_zorder):
359368 x , y = np .meshgrid (np .arange (0 , 10 ), np .arange (0 , 10 ))
360369 z = np .max (np .dstack ([abs (x ), abs (y )]), 2 )
361370
362- fig , (ax1 , ax2 ) = plt .subplots (ncols = 2 )
363- cs = ax1 .contour (x , y , z , zorder = contour_zorder )
364- cs_filled = ax2 .contourf (x , y , z , zorder = contour_zorder )
365- clabels1 = cs .clabel (zorder = clabel_zorder , use_clabeltext = use_clabeltext )
366- clabels2 = cs_filled .clabel (zorder = clabel_zorder ,
367- use_clabeltext = use_clabeltext )
371+ fig , ax = plt .subplots ()
372+ cs = ax .contour (x , y , z , zorder = contour_zorder )
373+ clabels = cs .clabel (zorder = clabel_zorder , use_clabeltext = use_clabeltext )
368374
369375 if clabel_zorder is None :
370376 expected_clabel_zorder = 2 + contour_zorder
371377 else :
372378 expected_clabel_zorder = clabel_zorder
373379
374- for clabel in clabels1 :
375- assert clabel .get_zorder () == expected_clabel_zorder
376- for clabel in clabels2 :
380+ for clabel in clabels :
377381 assert clabel .get_zorder () == expected_clabel_zorder
378382
379383
0 commit comments