@@ -1220,7 +1220,7 @@ def test_pcolormesh_alpha():
1220
1220
Qy = Y + np .sin (X )
1221
1221
Z = np .hypot (X , Y ) / 5
1222
1222
Z = (Z - Z .min ()) / Z .ptp ()
1223
- vir = plt . get_cmap ( "viridis" , 16 )
1223
+ vir = mpl . colormaps [ "viridis" ]. resampled ( 16 )
1224
1224
# make another colormap with varying alpha
1225
1225
colors = vir (np .arange (16 ))
1226
1226
colors [:, 3 ] = 0.5 + 0.5 * np .sin (np .arange (16 ))
@@ -2279,7 +2279,7 @@ def test_contour_hatching():
2279
2279
x , y , z = contour_dat ()
2280
2280
fig , ax = plt .subplots ()
2281
2281
ax .contourf (x , y , z , 7 , hatches = ['/' , '\\ ' , '//' , '-' ],
2282
- cmap = plt . get_cmap ( 'gray' ) ,
2282
+ cmap = mpl . colormaps [ 'gray' ] ,
2283
2283
extend = 'both' , alpha = 0.5 )
2284
2284
2285
2285
@@ -2289,7 +2289,7 @@ def test_contour_colorbar():
2289
2289
2290
2290
fig , ax = plt .subplots ()
2291
2291
cs = ax .contourf (x , y , z , levels = np .arange (- 1.8 , 1.801 , 0.2 ),
2292
- cmap = plt . get_cmap ( 'RdBu' ) ,
2292
+ cmap = mpl . colormaps [ 'RdBu' ] ,
2293
2293
vmin = - 0.6 ,
2294
2294
vmax = 0.6 ,
2295
2295
extend = 'both' )
@@ -2473,7 +2473,7 @@ def test_scatter_edgecolor_RGB(self):
2473
2473
@check_figures_equal (extensions = ["png" ])
2474
2474
def test_scatter_invalid_color (self , fig_test , fig_ref ):
2475
2475
ax = fig_test .subplots ()
2476
- cmap = plt . get_cmap ( "viridis" , 16 )
2476
+ cmap = mpl . colormaps [ "viridis" ]. resampled ( 16 )
2477
2477
cmap .set_bad ("k" , 1 )
2478
2478
# Set a nonuniform size to prevent the last call to `scatter` (plotting
2479
2479
# the invalid points separately in fig_ref) from using the marker
@@ -2482,15 +2482,15 @@ def test_scatter_invalid_color(self, fig_test, fig_ref):
2482
2482
c = [1 , np .nan , 2 , np .nan ], s = [1 , 2 , 3 , 4 ],
2483
2483
cmap = cmap , plotnonfinite = True )
2484
2484
ax = fig_ref .subplots ()
2485
- cmap = plt . get_cmap ( "viridis" , 16 )
2485
+ cmap = mpl . colormaps [ "viridis" ]. resampled ( 16 )
2486
2486
ax .scatter ([0 , 2 ], [0 , 2 ], c = [1 , 2 ], s = [1 , 3 ], cmap = cmap )
2487
2487
ax .scatter ([1 , 3 ], [1 , 3 ], s = [2 , 4 ], color = "k" )
2488
2488
2489
2489
@check_figures_equal (extensions = ["png" ])
2490
2490
def test_scatter_no_invalid_color (self , fig_test , fig_ref ):
2491
2491
# With plotnonfinite=False we plot only 2 points.
2492
2492
ax = fig_test .subplots ()
2493
- cmap = plt . get_cmap ( "viridis" , 16 )
2493
+ cmap = mpl . colormaps [ "viridis" ]. resampled ( 16 )
2494
2494
cmap .set_bad ("k" , 1 )
2495
2495
ax .scatter (range (4 ), range (4 ),
2496
2496
c = [1 , np .nan , 2 , np .nan ], s = [1 , 2 , 3 , 4 ],
0 commit comments