s-news
[Top] [All Lists]

[S] closed contours?

To: s-news <s-news@wubios.wustl.edu>
Subject: [S] closed contours?
From: Tim Smith <tsmith@whsun1.wh.whoi.edu>
Date: Fri, 23 Apr 1999 09:52:56 -0400
Reply-to: Tim.Smith@noaa.gov
Sender: owner-s-news@wubios.wustl.edu
I am trying to compute geographic areas enclosed by contours of the
results of kde2d.  For this I need closed contours, that is where the
first and the last points are very near or identical.  Does anyone have
such a function or know how to make contour behave better?

I used the function contour with a parameter save=T.  The contours
returned are usually closed or near enough.  However, sometimes what
looks like it should be a single contour is broken into two or more
segments that are far from closed, indeed nearly linear.  It looks like
it may be some edge effect because often (but not always) the x or the y
values of the endpoints of different segments are exactly the same.  The
behavior did not change with triangles=T.

It is not trivial to hook up these line segments as the segments
(separated by NAs) are not always adjacent and may be running in
opposite directions.  I wrote a simple procedure to display each for
inspection and manipulation, but it is not very much fun.  So I'm
looking for something that would avoid the problem by producing closed
contours.

Tim

PS: I had a minor problem with save=T that people may want to be aware
of.  Sometimes the function contour with save=T would not return
anything even when it clearly should be able to.  I found that if I
first called contour with test=F, forcing a plot, and then immediately
and identically a second time with save=T, I always got contours vectors
returned.  A little spooky.



-- 
Tim D Smith
Northeast Fisheries Science Center
166 Water St
Woods Hole, Massachusetts 02543 USA

email:  Tim.Smith@noaa.gov
voice:  508-495-2251
fax:    508-495-2258
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] closed contours?, Tim Smith <=