Get grid points of a specific plot in python
Question: I have plotted a map using matplotlib. I want the coordinates of all grid
points within the map and neglect all the grid points outside the map. Is
there any method which can be used directly in this? Intertools is giving all
the grid points but i want only the points within the map.

    
    
    import matplotlib.pylab as pt
    import itertools
    pt.set_xticks(np.arange(65,100,.75))
    pt.set_yticks(np.arange(0,100,.75))
    gridpoints = list( itertools.product(xticks, yticks) )
    print gridpoints
    


Answer: I'm not entirely sure what you're trying to do, but I'll venture a guess. If
you're trying to get all of the grid line intersections on a plot you might
try something like this:

    
    
    def getGridPoints(ax):
        xticks = ax.get_xticks()
        yticks = ax.get_yticks()
        xmin, xmax = ax.get_xbound()
        ymin, ymax = ax.get_ybound()
    
        return list( itertools.product( [x for x in xticks if x>xmin and x<xmax],
                                        [y for y in yticks if y>ymin and y<ymax]))
    

