#NEWLINE# def _auto_nbin( self , calculate_only = False ) : #NEWLINE# #INDENT# data = set ( ( a . layer . data for a in self . _artists ) ) #NEWLINE# if ( len ( data ) == 0 ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# dx = np . mean ( [ d . size for d in data ] ) #NEWLINE# val = min ( max ( 5 , ( ( ( dx / 1000 ) ** ( 1.0 / 3.0 ) ) * 30 ) ) , 100 ) #NEWLINE# c = list ( self . _get_data_components ( 'x' ) ) #NEWLINE# if c : #NEWLINE# #INDENT# c = c [ 0 ] #NEWLINE# if c . categorical : #NEWLINE# #INDENT# val = min ( c . categories . size , 100 ) #NEWLINE# if ( not calculate_only ) : #NEWLINE# #INDENT# self . xlimits = ( ( - 0.5 ) , ( dx . categories . size - 0.5 ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( not calculate_only ) : #NEWLINE# #INDENT# self . nbins = val #NEWLINE# #UNINDENT# return val