def _label2idx(params, pos):
 labels = params['ax'].yaxis.get_ticklabels()
 offsets = (np.array(params['offsets']) + params['offsets'][0])
 line_idx = np.searchsorted(offsets, pos[1])
 text = labels[line_idx].get_text()
 if (len(text) == 0):
  return (None, None)
 ch_idx = (params['ch_start'] + line_idx)
 return (text, ch_idx)

def _label2idx ( params , pos ) : labels = params [ 'ax' ] . yaxis . get_ticklabels ( ) offsets = ( np . array ( params [ 'offsets' ] ) + params [ 'offsets' ] [ 0 ] ) line_idx = np . searchsorted ( offsets , pos [ 1 ] ) text = labels [ line_idx ] . get_text ( ) if ( len ( text ) == 0 ) : return ( None , None ) ch_idx = ( params [ 'ch_start' ] + line_idx ) return ( text , ch_idx )
handle click on labels .