#NEWLINE# def __init__( self , data , pivot_kws = None , z_score = None , standard_scale = None , figsize = None , row_colors = None , col_colors = None , mask = None ) : #NEWLINE# #INDENT# 'Grid object for organizing clustered heatmap input on to axes' #NEWLINE# if isinstance ( data , pd . DataFrame ) : #NEWLINE# #INDENT# self . data = data #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . data = pd . DataFrame ( data ) #NEWLINE# #UNINDENT# self . data2d = self . format_data ( self . data , pivot_kws , z_score , standard_scale ) #NEWLINE# self . mask = _matrix_mask ( self . data2d , mask ) #NEWLINE# if ( figsize is None ) : #NEWLINE# #INDENT# ( width , height ) = ( 10 , 10 ) #NEWLINE# figsize = ( width , height ) #NEWLINE# #UNINDENT# self . fig = plt . figure ( figsize = figsize ) #NEWLINE# ( self . row_colors , self . row_color_labels ) = self . _preprocess_colors ( data , row_colors , axis = 0 ) #NEWLINE# ( self . col_colors , self . col_color_labels ) = self . _preprocess_colors ( data , col_colors , axis = 1 ) #NEWLINE# width_ratios = self . dim_ratios ( self . row_colors , figsize = figsize , axis = 1 ) #NEWLINE# height_ratios = self . dim_ratios ( self . col_colors , figsize = figsize , axis = 0 ) #NEWLINE# nrows = ( 3 if ( self . col_colors is None ) else 4 ) #NEWLINE# ncols = ( 3 if ( self . row_colors is None ) else 4 ) #NEWLINE# self . gs = gridspec . GridSpec ( nrows , ncols , wspace = 0.01 , hspace = 0.01 , width_ratios = width_ratios , height_ratios = height_ratios ) #NEWLINE# self . ax_row_dendrogram = self . fig . add_subplot ( self . gs [ ( nrows - 1 ) , 0 : 2 ] , axisbg = 'white' ) #NEWLINE# self . ax_col_dendrogram = self . fig . add_subplot ( self . gs [ 0 : 2 , ( ncols - 1 ) ] , axisbg = 'white' ) #NEWLINE# self . ax_row_colors = None #NEWLINE# self . ax_col_colors = None #NEWLINE# if ( self . row_colors is not None ) : #NEWLINE# #INDENT# self . ax_row_colors = self . fig . add_subplot ( self . gs [ ( ( nrows - 1 ) , ( ncols - 2 ) ) ] ) #NEWLINE# #UNINDENT# if ( self . col_colors is not None ) : #NEWLINE# #INDENT# self . ax_col_colors = self . fig . add_subplot ( self . gs [ ( ( nrows - 2 ) , ( ncols - 1 ) ) ] ) #NEWLINE# #UNINDENT# self . ax_heatmap = self . fig . add_subplot ( self . gs [ ( ( nrows - 1 ) , ( ncols - 1 ) ) ] ) #NEWLINE# self . cax = self . fig . add_subplot ( self . gs [ ( 0 , 0 ) ] ) #NEWLINE# self . dendrogram_row = None #NEWLINE# self . dendrogram_col = None