Hi, I have matrix of sea bottom depths that I am plotting in R with the function 'image'. I am particularly interested in the 200m depth contour (I'm using 'distance from this feature' as a covariate in a model) and would like to extract the data at evenly spaced points along it. I can easily superimpose a line at 200m using the function 'contour'. What I want to know is: can I actually get the data used to plot this line? If I just select the relevant data depth[depth==200] I get a very few observations, but if I say select depth[depth > 180 & depth < 220] I get a "band" of unevenly space data along the contour which I don't want either. Regards, Doug Beare Fisheries Research Services, Marine Laboratory, Victoria Road, Torry, Aberdeen, UK. Tel. 44 (0) 1224 295314
A question very much like this was answered two days ago. I couldn't find it from "www.r-project.org" -> search -> R Site Search. When I went "search" -> "searchable mail archives" -> "r-help" -> "date view", I found it. I found two replies with "isocontour-lines" in the subject, both dated 6/16/2003. One referred to the same question having been answered in late May. With that key word, a more targeted search might produce more. hth, spencer graves Douglas Beare wrote:> Hi, > I have matrix of sea bottom depths that I am plotting in R with the function > 'image'. > I am particularly interested in the 200m depth contour (I'm using 'distance > from this feature' as a covariate in a model) and would like to extract the > data at evenly > spaced points along it. I can easily superimpose a line at 200m using the > function 'contour'. What I > want to know is: can I actually get the data used to plot this line? If I > just select the relevant data depth[depth==200] I > get a very few observations, but if I say select depth[depth > 180 & depth < > 220] I get a "band" of > unevenly space data along the contour which I don't want either. > Regards, > Doug Beare > Fisheries Research Services, > Marine Laboratory, > Victoria Road, > Torry, > Aberdeen, UK. > Tel. 44 (0) 1224 295314 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
On Wed, 18 Jun 2003, Douglas Beare wrote:> Hi, > I have matrix of sea bottom depths that I am plotting in R with the function > 'image'. > I am particularly interested in the 200m depth contour (I'm using 'distance > from this feature' as a covariate in a model) and would like to extract the > data at evenly > spaced points along it. I can easily superimpose a line at 200m using the > function 'contour'. What I > want to know is: can I actually get the data used to plot this line? If I > just select the relevant data depth[depth==200] I > get a very few observations, but if I say select depth[depth > 180 & depth < > 220] I get a "band" of > unevenly space data along the contour which I don't want either.This is a different question to the "can I retrieve a contour line from contour()" - it presupposes that we have the line, but asks which cells of the array are intersected by the line, is that right? It could also be used to interrogate any other image/raster layer for the same area, not just depth. Polygon clipping is available in the gcplib package, but that may be overkill. If the (contour) line(s) can be converted into sequences of points closer together than the raster resolution, it should be possible to identify the raster cells they belong to (row and column numbers). If this was GIS data, it might be easier to do the overlay operation there, especially if you need a buffer around the line. Roger> Regards, > Doug Beare > Fisheries Research Services, > Marine Laboratory, > Victoria Road, > Torry, > Aberdeen, UK. > Tel. 44 (0) 1224 295314 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: Roger.Bivand at nhh.no
You may be interested in this message (from the archives): https://www.stat.math.ethz.ch/pipermail/r-help/2003-June/033583.html -roger Douglas Beare wrote:> Hi, > I have matrix of sea bottom depths that I am plotting in R with the function > 'image'. > I am particularly interested in the 200m depth contour (I'm using 'distance > from this feature' as a covariate in a model) and would like to extract the > data at evenly > spaced points along it. I can easily superimpose a line at 200m using the > function 'contour'. What I > want to know is: can I actually get the data used to plot this line? If I > just select the relevant data depth[depth==200] I > get a very few observations, but if I say select depth[depth > 180 & depth < > 220] I get a "band" of > unevenly space data along the contour which I don't want either. > Regards, > Doug Beare > Fisheries Research Services, > Marine Laboratory, > Victoria Road, > Torry, > Aberdeen, UK. > Tel. 44 (0) 1224 295314 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >