@@ -420,6 +420,45 @@ def test_surface3d_shaded():
420420 ax .set_zlim (- 1.01 , 1.01 )
421421
422422
423+ @mpl3d_image_comparison (['surface3d_masked.png' ])
424+ def test_surface3d_masked ():
425+ fig = plt .figure ()
426+ ax = fig .add_subplot (projection = '3d' )
427+ x = [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 ]
428+ y = [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ]
429+
430+ x , y = np .meshgrid (x , y )
431+ matrix = np .array (
432+ [
433+ [- 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
434+ [- 1 , 1 , 2 , 3 , 4 , 4 , 4 , 3 , 2 , 1 , 1 ],
435+ [- 1 , - 1. , 4 , 5 , 6 , 8 , 6 , 5 , 4 , 3 , - 1. ],
436+ [- 1 , - 1. , 7 , 8 , 11 , 12 , 11 , 8 , 7 , - 1. , - 1. ],
437+ [- 1 , - 1. , 8 , 9 , 10 , 16 , 10 , 9 , 10 , 7 , - 1. ],
438+ [- 1 , - 1. , - 1. , 12 , 16 , 20 , 16 , 12 , 11 , - 1. , - 1. ],
439+ [- 1 , - 1. , - 1. , - 1. , 22 , 24 , 22 , 20 , 18 , - 1. , - 1. ],
440+ [- 1 , - 1. , - 1. , - 1. , - 1. , 28 , 26 , 25 , - 1. , - 1. , - 1. ],
441+ ]
442+ )
443+ z = np .ma .masked_less (matrix , 0 )
444+ norm = mcolors .Normalize (vmax = z .max (), vmin = z .min ())
445+ colors = plt .get_cmap ("plasma" )(norm (z ))
446+ ax .plot_surface (x , y , z , facecolors = colors )
447+ ax .view_init (30 , - 80 )
448+
449+
450+ @mpl3d_image_comparison (['surface3d_masked_strides.png' ])
451+ def test_surface3d_masked_strides ():
452+ fig = plt .figure ()
453+ ax = fig .add_subplot (projection = '3d' )
454+
455+ x , y = np .mgrid [- 6 :6.1 :1 , - 6 :6.1 :1 ]
456+ z = np .ma .masked_less (x * y , 2 )
457+
458+ ax .plot_surface (x , y , z , rstride = 4 , cstride = 4 )
459+ ax .view_init (60 , - 45 )
460+
461+
423462@mpl3d_image_comparison (['text3d.png' ], remove_text = False )
424463def test_text3d ():
425464 fig = plt .figure ()
0 commit comments