Re: isodensity contours [message #75357 is a reply to message #75267] |
Thu, 24 February 2011 08:28  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
On Feb 23, 7:34 pm, Gray <grayliketheco...@gmail.com> wrote:
> On Feb 23, 3:24 pm, Paolo <pgri...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>> On Feb 23, 3:06 pm, Gray <grayliketheco...@gmail.com> wrote:
>
>>> On Feb 23, 2:12 pm, Paolo <pgri...@gmail.com> wrote:
>
>>>> On Feb 23, 1:24 pm, Gray <grayliketheco...@gmail.com> wrote:
>
>>>> > Hi all,
>
>>>> > I have a scatterplot with a bunch of points on it. I'd like to plot
>>>> > isodensity contours to include 99%, 90%, 75%, and 50% of my points.
>>>> > How do I set up my data to give to cgContour? Thanks!
>
>>>> > --Gray
>
>>>> If I understand this correctly, you have two arrays
>>>> x and y of coordinates of N points.
>
>>>> To contour them, you need first to create a
>>>> density array from your dataset - basically
>>>> you divide the xrange and yrange of your data
>>>> in a number of bins and the density array will
>>>> tell you how many points lie in each bin.
>
>>>> Then you can use the normal contour procedures.
>
>>>> So how you do partition the data into the density
>>>> array? hist_2d will do that for you.
>
>>>> Ciao,
>>>> Paolo
>
>>> I thought I posted this already... if it shows up twice, I'm sorry.
>
>>> Upon further reflection, I think that "isodensity contours" are not
>>> exactly what I want, though I may need to use them anyway (as
>>> described by Paolo) if I can't figure out a way to do EXACTLY what I
>>> want.
>
>>> Here's some more detail on my issue. I have a plot for which the x-
>>> axis is stellar magnitude in one image, and the y-axis is stellar
>>> magnitude in a different image. I have two populations of stars (pop
>>> A and pop B). Pop A is pretty clustered, but the cluster is sort of
>>> smeared out so I can't use a simple centroid. I'd like to see where
>>> the pop B stars lay on the plot in relation to the pop A stars by
>>> plotting contours showing what percentage of pop A stars are within
>>> them (99%,90%,75%,50%). Is this doable without getting really
>>> complicated, or should I use the isodensity contours instead?
>
>>> An example image is athttp://tinypic.com/r/2mepz4/7
>>> The black points are pop A and the colored symbols are pop B.
>
>>> Thanks for your help!
>
>>> --Gray
>
>> I would at least try to get the density for the pop A
>> stars - will take only a few minutes to do. You may want
>> to smooth the contours a bit. But it looks like it should
>> come out reasonably well...
>
>> Ciao,
>> Paolo
>
> How does one smooth contours? :/
IDL has a builtin function called min_curve_surf
It's a bit slow though - use it on small arrays
Ciao,
Paolo
|
|
|