Contour of Number of Occurences in a Scatter Plot

Does anyone know how to do a contour plot of a set of X,Y data where each
contour level has the same number of data points inside it? What I want to
show is where most of the data is appearing in the x, y position for a
scatter plot of ~1,000 points, so you can't just plot all those as points.
This is similar to the probability density function for a scatter plot.

In concept, you would start at the median of x and median of y and then
include points by their distance from the median until you reach the number
in each contour and draw a contour around this region. Then you would
proceed outward from the contour to find more points.

An alternative, but not exactly correct approach I have already done is to
bin the data like a 2D histogram and then use the number of occurrences in
each bin as the z value for contourf.

I see this plot a lot in the scientific literature, so I know it must be
possible, but haven't been able to find it on the web for python.

Thanks,
Mike

ยทยทยท

--
View this message in context: http://www.nabble.com/Contour-of-Number-of-Occurences-in-a-Scatter-Plot-tp25083681p25083681.html
Sent from the matplotlib - users mailing list archive at Nabble.com.