Python ginput not allowing new points to be plotted
Question: This code asks the user to digitize three points (using ginput), then should
plot those points to the screen atop the imshow plot. It does not. Any ideas
why?

    
    
    from pylab import show, ginput, rand, imshow, plot
    from matplotlib.figure import Figure
    import numpy as np
    
    x1 = rand(103, 53) 
    figure = Figure(figsize=(4, 4), dpi=100)
    axes = figure.add_subplot(111)
    
    imshow(x1)
    
    # Get user input
    x = ginput(3)
    x = np.array(x)
    
    # Plot the user's points to the screen
    plot(x[:, 0], x[:, 1], 'k*', ms=50)
    show()
    


Answer: Not sure which way you are trying to plot, the star and the background or vice
versa but you need to change the order of your calls.

    
    
    plot(10, 30, 'k*', ms=100)
    x = ginput(2)
    imshow(x1)
    
    show()
    

This will show a star then when you click two points show your rand data.

This is a nice example of using ginput taken from
[here](http://matplotlib.org/examples/pylab_examples/ginput_manual_clabel.html):

    
    
    import time
    import numpy as np
    import matplotlib.pyplot as plt
    
    def tellme(s):
        print(s)
        plt.title(s,fontsize=16)
        plt.draw()
    
    ##################################################
    # Define a triangle by clicking three points
    ##################################################
    plt.clf()
    plt.axis([-1.,1.,-1.,1.])
    plt.setp(plt.gca(),autoscale_on=False)
    
    tellme('You will define a triangle, click to begin')
    
    plt.waitforbuttonpress()
    
    happy = False
    while not happy:
        pts = []
        while len(pts) < 3:
            tellme('Select 3 corners with mouse')
            pts = np.asarray( plt.ginput(3,timeout=-1) )
            if len(pts) < 3:
                tellme('Too few points, starting over')
                time.sleep(1) # Wait a second
    
        ph = plt.fill( pts[:,0], pts[:,1], 'r', lw=2 )
    
        tellme('Happy? Key click for yes, mouse click for no')
    
        happy = plt.waitforbuttonpress()
    
        # Get rid of fill
        if not happy:
            for p in ph: p.remove()
    

