@@ -295,91 +295,91 @@ def test_Normalize():
295295 assert 0 < norm (1 + 50 * eps ) < 1
296296
297297
298- def test_DivergingNorm_autoscale ():
299- norm = mcolors .DivergingNorm (vcenter = 20 )
298+ def test_TwoSlopeNorm_autoscale ():
299+ norm = mcolors .TwoSlopeNorm (vcenter = 20 )
300300 norm .autoscale ([10 , 20 , 30 , 40 ])
301301 assert norm .vmin == 10.
302302 assert norm .vmax == 40.
303303
304304
305- def test_DivergingNorm_autoscale_None_vmin ():
306- norm = mcolors .DivergingNorm (2 , vmin = 0 , vmax = None )
305+ def test_TwoSlopeNorm_autoscale_None_vmin ():
306+ norm = mcolors .TwoSlopeNorm (2 , vmin = 0 , vmax = None )
307307 norm .autoscale_None ([1 , 2 , 3 , 4 , 5 ])
308308 assert norm (5 ) == 1
309309 assert norm .vmax == 5
310310
311311
312- def test_DivergingNorm_autoscale_None_vmax ():
313- norm = mcolors .DivergingNorm (2 , vmin = None , vmax = 10 )
312+ def test_TwoSlopeNorm_autoscale_None_vmax ():
313+ norm = mcolors .TwoSlopeNorm (2 , vmin = None , vmax = 10 )
314314 norm .autoscale_None ([1 , 2 , 3 , 4 , 5 ])
315315 assert norm (1 ) == 0
316316 assert norm .vmin == 1
317317
318318
319- def test_DivergingNorm_scale ():
320- norm = mcolors .DivergingNorm (2 )
319+ def test_TwoSlopeNorm_scale ():
320+ norm = mcolors .TwoSlopeNorm (2 )
321321 assert norm .scaled () is False
322322 norm ([1 , 2 , 3 , 4 ])
323323 assert norm .scaled () is True
324324
325325
326- def test_DivergingNorm_scaleout_center ():
326+ def test_TwoSlopeNorm_scaleout_center ():
327327 # test the vmin never goes above vcenter
328- norm = mcolors .DivergingNorm (vcenter = 0 )
328+ norm = mcolors .TwoSlopeNorm (vcenter = 0 )
329329 norm ([1 , 2 , 3 , 5 ])
330330 assert norm .vmin == 0
331331 assert norm .vmax == 5
332332
333333
334- def test_DivergingNorm_scaleout_center_max ():
334+ def test_TwoSlopeNorm_scaleout_center_max ():
335335 # test the vmax never goes below vcenter
336- norm = mcolors .DivergingNorm (vcenter = 0 )
336+ norm = mcolors .TwoSlopeNorm (vcenter = 0 )
337337 norm ([- 1 , - 2 , - 3 , - 5 ])
338338 assert norm .vmax == 0
339339 assert norm .vmin == - 5
340340
341341
342- def test_DivergingNorm_Even ():
343- norm = mcolors .DivergingNorm (vmin = - 1 , vcenter = 0 , vmax = 4 )
342+ def test_TwoSlopeNorm_Even ():
343+ norm = mcolors .TwoSlopeNorm (vmin = - 1 , vcenter = 0 , vmax = 4 )
344344 vals = np .array ([- 1.0 , - 0.5 , 0.0 , 1.0 , 2.0 , 3.0 , 4.0 ])
345345 expected = np .array ([0.0 , 0.25 , 0.5 , 0.625 , 0.75 , 0.875 , 1.0 ])
346346 assert_array_equal (norm (vals ), expected )
347347
348348
349- def test_DivergingNorm_Odd ():
350- norm = mcolors .DivergingNorm (vmin = - 2 , vcenter = 0 , vmax = 5 )
349+ def test_TwoSlopeNorm_Odd ():
350+ norm = mcolors .TwoSlopeNorm (vmin = - 2 , vcenter = 0 , vmax = 5 )
351351 vals = np .array ([- 2.0 , - 1.0 , 0.0 , 1.0 , 2.0 , 3.0 , 4.0 , 5.0 ])
352352 expected = np .array ([0.0 , 0.25 , 0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1.0 ])
353353 assert_array_equal (norm (vals ), expected )
354354
355355
356- def test_DivergingNorm_VminEqualsVcenter ():
356+ def test_TwoSlopeNorm_VminEqualsVcenter ():
357357 with pytest .raises (ValueError ):
358- mcolors .DivergingNorm (vmin = - 2 , vcenter = - 2 , vmax = 2 )
358+ mcolors .TwoSlopeNorm (vmin = - 2 , vcenter = - 2 , vmax = 2 )
359359
360360
361- def test_DivergingNorm_VmaxEqualsVcenter ():
361+ def test_TwoSlopeNorm_VmaxEqualsVcenter ():
362362 with pytest .raises (ValueError ):
363- mcolors .DivergingNorm (vmin = - 2 , vcenter = 2 , vmax = 2 )
363+ mcolors .TwoSlopeNorm (vmin = - 2 , vcenter = 2 , vmax = 2 )
364364
365365
366- def test_DivergingNorm_VminGTVcenter ():
366+ def test_TwoSlopeNorm_VminGTVcenter ():
367367 with pytest .raises (ValueError ):
368- mcolors .DivergingNorm (vmin = 10 , vcenter = 0 , vmax = 20 )
368+ mcolors .TwoSlopeNorm (vmin = 10 , vcenter = 0 , vmax = 20 )
369369
370370
371- def test_DivergingNorm_DivergingNorm_VminGTVmax ():
371+ def test_TwoSlopeNorm_TwoSlopeNorm_VminGTVmax ():
372372 with pytest .raises (ValueError ):
373- mcolors .DivergingNorm (vmin = 10 , vcenter = 0 , vmax = 5 )
373+ mcolors .TwoSlopeNorm (vmin = 10 , vcenter = 0 , vmax = 5 )
374374
375375
376- def test_DivergingNorm_VcenterGTVmax ():
376+ def test_TwoSlopeNorm_VcenterGTVmax ():
377377 with pytest .raises (ValueError ):
378- mcolors .DivergingNorm (vmin = 10 , vcenter = 25 , vmax = 20 )
378+ mcolors .TwoSlopeNorm (vmin = 10 , vcenter = 25 , vmax = 20 )
379379
380380
381- def test_DivergingNorm_premature_scaling ():
382- norm = mcolors .DivergingNorm (vcenter = 2 )
381+ def test_TwoSlopeNorm_premature_scaling ():
382+ norm = mcolors .TwoSlopeNorm (vcenter = 2 )
383383 with pytest .raises (ValueError ):
384384 norm .inverse (np .array ([0.1 , 0.5 , 0.9 ]))
385385
@@ -915,3 +915,8 @@ def test_same_color():
915915def test_hex_shorthand_notation ():
916916 assert mcolors .same_color ("#123" , "#112233" )
917917 assert mcolors .same_color ("#123a" , "#112233aa" )
918+
919+
920+ def test_DivergingNorm_deprecated ():
921+ with pytest .warns (cbook .MatplotlibDeprecationWarning ):
922+ norm = mcolors .DivergingNorm (vcenter = 0 )
0 commit comments