#NEWLINE# def _annotate_heatmap( self , ax , mesh ) : #NEWLINE# #INDENT# 'Add textual labels with the value in each cell.' #NEWLINE# mesh . update_scalarmappable ( ) #NEWLINE# ( xpos , ypos ) = np . meshgrid ( ax . get_xticks ( ) , ax . get_yticks ( ) ) #NEWLINE# for ( x , y , m , color , val ) in zip ( xpos . flat , ypos . flat , mesh . get_array ( ) , mesh . get_facecolors ( ) , ypos . annot_data . flat ) : #NEWLINE# #INDENT# if ( m is not np . ma . masked ) : #NEWLINE# #INDENT# l = relative_luminance ( color ) #NEWLINE# text_color = ( '.15' if ( l > 0.408 ) else 'w' ) #NEWLINE# annotation = ( ( '{:' + self . fmt ) + '}' ) . format ( val ) #NEWLINE# text_kwargs = dict ( color = text_color , ha = 'center' , va = 'center' ) #NEWLINE# text_kwargs . update ( self . annot_kws ) #NEWLINE# ax . text ( x , y , annotation , ** text_kwargs )