@image_comparison(baseline_images=[u'grayscale_alpha'], extensions=[u'pdf'])
def test_grayscale_alpha():
 (x, y) = np.ogrid[(-2):2:0.1, (-2):2:0.1]
 dd = np.exp((- ((x ** 2) + (y ** 2))))
 dd[(dd < 0.1)] = np.nan
 (fig, ax) = plt.subplots()
 ax.imshow(dd, interpolation=u'none', cmap=u'gray_r')
 ax.set_xticks([])
 ax.set_yticks([])

@ image_comparison ( baseline_images = [ u'grayscale_alpha' ] , extensions = [ u'pdf' ] ) def test_grayscale_alpha ( ) : ( x , y ) = np . ogrid [ ( - 2 ) : 2 : 0.1 , ( - 2 ) : 2 : 0.1 ] dd = np . exp ( ( - ( ( x ** 2 ) + ( y ** 2 ) ) ) ) dd [ ( dd < 0.1 ) ] = np . nan ( fig , ax ) = plt . subplots ( ) ax . imshow ( dd , interpolation = u'none' , cmap = u'gray_r' ) ax . set_xticks ( [ ] ) ax . set_yticks ( [ ] )
masking images with nan did not work for grayscale images .