FigureData.py
def onclick(event):
    """
    Event handler for clicks in the matplotlib plot window
    """
    if event.xdata is None:
        ### Click was outside the plot region
        #print 'Outside (%d, %d)' %(event.x, event.y)
        
        ### Write the output file
        fp = open(G.output_file, 'w')
        for i in range(len(G.xdata)-6):
            xi, yi = G.xdata[i+6], G.ydata[i+6]
            xval, yval = translate_xy(xi, yi)
            inplot = ((xi >= G.ll[0]) & (xi <= G.ur[0]) & 
                     (yi >= G.ll[1]) & (yi <= G.ur[1]))
                     
            fp.write('%f %f %d\n' %(xval, yval, inplot*1))
        
        fp.close()
        print(('Saved to %s.' %(G.output_file)))
        
    else:
        #print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(event.button, event.x, event.y, event.xdata, event.ydata)
        G.xdata.append(event.xdata)
        G.ydata.append(event.ydata)
        #
        if len(G.xdata) < 7:
            print('< mark >')

        if len(G.xdata) > 6:
            xval, yval = translate_xy(G.xdata[-1], G.ydata[-1])
            print('Mark [%f,%f]' %(xval, yval))
            G.ax.scatter(G.xdata[-1], G.ydata[-1], marker='o', color='white', s=40, alpha=0.7)
            G.ax.scatter(G.xdata[-1], G.ydata[-1], marker='o', color='red', s=20, alpha=0.7)
            plt.draw()

    Event handler for clicks in the matplotlib plot window
    
Event handler for clicks in the matplotlib plot window
Event handler for clicks in the matplotlib plot window
def onclick(event):
    if event.xdata is None:
        fp = open(G.output_file, 'w')
        for i in range(len(G.xdata)-6):
            xi, yi = G.xdata[i+6], G.ydata[i+6]
            xval, yval = translate_xy(xi, yi)
            inplot = ((xi >= G.ll[0]) & (xi <= G.ur[0]) & 
                     (yi >= G.ll[1]) & (yi <= G.ur[1]))
            fp.write('%f %f %d\n' %(xval, yval, inplot*1))
        fp.close()
        print(('Saved to %s.' %(G.output_file)))
    else:
        G.xdata.append(event.xdata)
        G.ydata.append(event.ydata)
        if len(G.xdata) < 7:
            print('< mark >')
        if len(G.xdata) > 6:
            xval, yval = translate_xy(G.xdata[-1], G.ydata[-1])
            print('Mark [%f,%f]' %(xval, yval))
            G.ax.scatter(G.xdata[-1], G.ydata[-1], marker='o', color='white', s=40, alpha=0.7)
            G.ax.scatter(G.xdata[-1], G.ydata[-1], marker='o', color='red', s=20, alpha=0.7)
            plt.draw()
def onclick ( event ) : if event . xdata is None : fp = open ( G . output_file , 'w' ) for i in range ( len ( G . xdata ) - 6 ) : xi , yi = G . xdata [ i + 6 ] , G . ydata [ i + 6 ] xval , yval = translate_xy ( xi , yi ) inplot = ( ( xi >= G . ll [ 0 ] ) & ( xi <= G . ur [ 0 ] ) & ( yi >= G . ll [ 1 ] ) & ( yi <= G . ur [ 1 ] ) ) fp . write ( '%f %f %d\n' % ( xval , yval , inplot * 1 ) ) fp . close ( ) print ( ( 'Saved to %s.' % ( G . output_file ) ) ) else : G . xdata . append ( event . xdata ) G . ydata . append ( event . ydata ) if len ( G . xdata ) < 7 : print ( '< mark >' ) if len ( G . xdata ) > 6 : xval , yval = translate_xy ( G . xdata [ - 1 ] , G . ydata [ - 1 ] ) print ( 'Mark [%f,%f]' % ( xval , yval ) ) G . ax . scatter ( G . xdata [ - 1 ] , G . ydata [ - 1 ] , marker = 'o' , color = 'white' , s = 40 , alpha = 0.7 ) G . ax . scatter ( G . xdata [ - 1 ] , G . ydata [ - 1 ] , marker = 'o' , color = 'red' , s = 20 , alpha = 0.7 ) plt . draw ( )
Event handler for clicks in the matplotlib plot window
Event handler for clicks in the matplotlib plot window
"""
    Event handler for clicks in the matplotlib plot window
    """ ### Click was outside the plot region #print 'Outside (%d, %d)' %(event.x, event.y) ### Write the output file #print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(event.button, event.x, event.y, event.xdata, event.ydata) #
event