#NEWLINE# def select_y( self , order = None , aggregator = None ) : #NEWLINE# #INDENT# "\n        Helper function that does a best effort of selecting an automatic y axis.\n        It won't set the same axis that x is set to again, so X has to be set for the method to be called.\n\n        Raises AssertionError if it cannot find a y axis to choose.\n        " #NEWLINE# assert ( self . data is not None ) #NEWLINE# assert ( len ( self . data ) >= 2 ) #NEWLINE# assert ( self . encoding is not None ) #NEWLINE# assert ( self . encoding . x is not None ) #NEWLINE# if ( order is None ) : #NEWLINE# #INDENT# order = [ 'Q' , 'O' , 'N' , 'T' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _validate_custom_order ( order ) #NEWLINE# #UNINDENT# x_name = self . encoding . x . name #NEWLINE# d = self . _classify_data_by_type ( order , [ x_name ] ) #NEWLINE# chosen_y = None #NEWLINE# for typ in order : #NEWLINE# #INDENT# if ( len ( d [ typ ] ) >= 1 ) : #NEWLINE# #INDENT# chosen_y = d [ typ ] [ 0 ] #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( chosen_y is None ) : #NEWLINE# #INDENT# raise ValueError ( 'Could not select Y.' ) #NEWLINE# #UNINDENT# if ( aggregator is not None ) : #NEWLINE# #INDENT# chosen_y = '{}({})' . format ( aggregator , chosen_y ) #NEWLINE# #UNINDENT# self . encoding . y = chosen_y