#NEWLINE# def plot_feat_hist( data_name_list , filename = None ) : #NEWLINE# #INDENT# pylab . clf ( ) #NEWLINE# num_rows = ( 1 + ( ( len ( data_name_list ) - 1 ) / 2 ) ) #NEWLINE# num_cols = ( 1 if ( len ( bins ) == 1 ) else 2 ) #NEWLINE# pylab . figure ( figsize = ( ( 5 * num_cols ) , ( 4 * num_rows ) ) ) #NEWLINE# for i in range ( num_rows ) : #NEWLINE# #INDENT# for j in range ( num_cols ) : #NEWLINE# #INDENT# pylab . subplot ( num_rows , num_cols , ( ( 1 + ( i * num_cols ) ) + j ) ) #NEWLINE# ( x , name ) = data_name_list [ ( ( i * num_cols ) + j ) ] #NEWLINE# pylab . title ( name ) #NEWLINE# pylab . xlabel ( 'Value' ) #NEWLINE# pylab . ylabel ( 'Density' ) #NEWLINE# max_val = np . max ( x ) #NEWLINE# if ( max_val <= 1.0 ) : #NEWLINE# #INDENT# bins = 50 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( max_val > 50 ) : #NEWLINE# #INDENT# bins = 50 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# bins = max_val #NEWLINE# #UNINDENT# #UNINDENT# ( n , bins , patches ) = pylab . hist ( x , bins = bins , normed = 1 , facecolor = 'green' , alpha = 0.75 ) #NEWLINE# pylab . grid ( True ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not filename ) : #NEWLINE# #INDENT# filename = ( 'feat_hist_%s.png' % name ) #NEWLINE# #UNINDENT# pylab . savefig ( os . path . join ( CHART_DIR , filename ) , bbox_inches = 'tight' )