#NEWLINE# def __call__( self , data , index ) : #NEWLINE# #INDENT# 'Return a colour corresponding to data attribute value.\n\n        Parameters:\n        -----------\n        data: pandas DataFrame\n        index: pandas DataFrame row index\n\n        Returns:\n        --------\n        A three element tuple representing an RGB somewhere along the line\n        of colour1, colour2 and colour3\n        ' #NEWLINE# x = data [ self . column ] . iget ( index ) #NEWLINE# a = min ( data [ self . column ] ) #NEWLINE# b = max ( data [ self . column ] ) #NEWLINE# ( r1 , g1 , b1 ) = self . colour1 #NEWLINE# ( r2 , g2 , b2 ) = self . colour2 #NEWLINE# ( r3 , g3 , b3 ) = self . colour3 #NEWLINE# x_scaled = ( ( x - a ) / ( b - a ) ) #NEWLINE# if ( x_scaled < 0.5 ) : #NEWLINE# #INDENT# x_scaled *= 2.0 #NEWLINE# return ( ( r1 + ( ( r2 - r1 ) * x_scaled ) ) , ( g1 + ( ( g2 - g1 ) * x_scaled ) ) , ( b1 + ( ( b2 - b1 ) * x_scaled ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# x_scaled = ( ( x_scaled - 0.5 ) * 2.0 ) #NEWLINE# return ( ( r2 + ( ( r3 - r2 ) * x_scaled ) ) , ( g2 + ( ( g3 - g2 ) * x_scaled ) ) , ( b2 + ( ( b3 - b2 ) * x_scaled ) ) )