#NEWLINE# def _jitter_envelope( pos_data , xvals , violin , side ) : #NEWLINE# #INDENT# 'Determine envelope for jitter markers.' #NEWLINE# if ( side == 'both' ) : #NEWLINE# #INDENT# ( low , high ) = ( ( - 1.0 ) , 1.0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( side == 'right' ) : #NEWLINE# #INDENT# ( low , high ) = ( 0 , 1.0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( side == 'left' ) : #NEWLINE# #INDENT# ( low , high ) = ( ( - 1.0 ) , 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( '`side` input incorrect: %s' % side ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# jitter_envelope = np . interp ( pos_data , xvals , violin ) #NEWLINE# jitter_coord = ( jitter_envelope * np . random . uniform ( low = low , high = high , size = pos_data . size ) ) #NEWLINE# return jitter_coord