def plot_density_heatmap(coordAmp):
    """Plots a heatmap of particle density using the average position of the
       particles"""
    average_pos = trackManipulations.find_average_positions(coordAmp)
    xpos,ypos = zip(*average_pos)
    plt.clf()
    ax = plt.gca()
    ax.set_aspect('equal', adjustable='box')
    heatmap,xedges,yedges = np.histogram2d(ypos, xpos, bins=25)
    extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
    plt.imshow(heatmap, extent=extent, origin = 'lower')
def plot_vector_direction(coordAmp):
    """Plots average vector direction as color"""
    tails = trackManipulations.find_track_starts(coordAmp)
    heads = trackManipulations.find_average_positions(coordAmp)
    tailArray = np.array(tails)    
    headArray = np.array(heads)
    vectors = list(headArray - tailArray)
    x,y = zip(*tails)
    u,v = zip(*vectors)
    directions = trackManipulations.generate_directions(vectors)
    scaledDirections = np.array(directions)/(2*pi)
    plt.clf()
    plt.figure()
    plt.scatter(x,y,c=scaledDirections)
    plt.draw()
    plt.show()
def plot_mean_vectors(coordAmp):
    """Plots the vectors of average motion"""
    tails = trackManipulations.find_track_starts(coordAmp)
    heads = trackManipulations.find_average_positions(coordAmp)
    tailArray = np.array(tails)    
    headArray = np.array(heads)
    vectors = list(headArray - tailArray)
    x,y = zip(*tails)
    u,v = zip(*vectors)
    plt.clf()
    plt.figure()
    ax = plt.gca()
    ax.set_aspect('equal', adjustable='box')
    ax.quiver(x,y,u,v,angles='xy', scale_units='xy', scale=1)
#    ax.set_xlim([60,80])
#    ax.set_ylim([180,200])
#    plt.draw()
    plt.show()