[R] Center of Closed Contour

Thomas W Blackwell tblackw at umich.edu
Wed Mar 19 18:59:32 CET 2003


I think you have to roll your own.  Best idea I can come up with is a
classic application of Monte Carlo integration.  Throw down a million
(say) random points, uniformly distributed throughout the 2D region
where the contours will be plotted.  For each point, evaluate whether
it is inside or outside the contours (equivalently, whether the surface
being contoured is above or below the contour level at this point).
Then calculate the sample mean of x coordinates, similarly y coordinates,
for all points which map inside the contour.  And ignore all random
points which fall outside the contour.

HTH  -  tom blackwell  -  u michigan medical school  -  ann arbor  -


On Wed, 19 Mar 2003, Charles M. Fleming wrote:

> I am searching for a utility in R which will determine the mean location of
> a closed contour and eventually record the location in an ASCII file. By
> means of the contour utility in R, I am able to produce an image of a contour,
> but I am seeking a procedure which will produce the coordinates of the
> center of mass of the contour. From my actual set of data, the contour
> utility will produce several hundered closed non-intersecting and
> non-concentric contours like a lattice of disks. I want the location of
> those disks via a program. Is there any package in R which will lend
> itself to this problem?
>
> Thank you,
>
> Charles Fleming
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>



More information about the R-help mailing list