#NEWLINE# def tabulate( self , * args , **kwargs ) : #NEWLINE# #INDENT# '\n        Tabulate the given samples from the conditional frequency distribution.\n\n        :param samples: The samples to plot\n        :type samples: list\n        :param conditions: The conditions to plot (default is all)\n        :type conditions: list\n        :param cumulative: A flag to specify whether the freqs are cumulative (default = False)\n        :type title: bool\n        ' #NEWLINE# cumulative = _get_kwarg ( kwargs , 'cumulative' , False ) #NEWLINE# conditions = _get_kwarg ( kwargs , 'conditions' , sorted ( self . conditions ( ) ) ) #NEWLINE# samples = _get_kwarg ( kwargs , 'samples' , sorted ( set ( ( v for c in conditions for v in self [ c ] ) ) ) ) #NEWLINE# width = max ( ( len ( ( '%s' % s ) ) for s in samples ) ) #NEWLINE# freqs = dict ( ) #NEWLINE# for c in conditions : #NEWLINE# #INDENT# if cumulative : #NEWLINE# #INDENT# freqs [ c ] = list ( self [ c ] . _cumulative_frequencies ( samples ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# freqs [ c ] = [ self [ c ] [ sample ] for sample in samples ] #NEWLINE# #UNINDENT# width = max ( width , max ( ( len ( ( '%d' % f ) ) for f in freqs [ c ] ) ) ) #NEWLINE# #UNINDENT# condition_size = max ( ( len ( ( '%s' % c ) ) for c in conditions ) ) #NEWLINE# print ( ( ' ' * condition_size ) , end = ' ' ) #NEWLINE# for s in samples : #NEWLINE# #INDENT# print ( ( '%*s' % ( width , s ) ) , end = ' ' ) #NEWLINE# #UNINDENT# print ( ) #NEWLINE# for c in conditions : #NEWLINE# #INDENT# print ( ( '%*s' % ( condition_size , c ) ) , end = ' ' ) #NEWLINE# for f in freqs [ c ] : #NEWLINE# #INDENT# print ( ( '%*d' % ( width , f ) ) , end = ' ' ) #NEWLINE# #UNINDENT# print ( )