Dear William, Duncan and Bert, Thanks a lot for your help and tips :D In fact the contour() plot still cannot solve my problem perfectly. As the resolution of my plot is very coarse, I want to a contour perfectly surround all grid cells in the river basin. In another word, I want all angle of the contour to be 90 degree. Another problem for the contour() is that the contour line doesn't close at where the value of neighbouring grid cell is NA. See the right side of the two contour lines (attachment). Do you know how I can get what I want? Thanks a lot :P
Cheers, Zun Yin On Thu, Aug 4, 2016 at 5:09 PM, Bert Gunter <bgunter.4...@gmail.com> wrote: > ... note the typo. It's: > > contour( basiinID == ID, level=0.5) > > :-) > > > -- Bert > > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Thu, Aug 4, 2016 at 8:03 AM, William Dunlap via R-help > <r-help@r-project.org> wrote: > > If 'basinID' is the matrix of basin identifiers you could draw an outline > > of the basin with identifier 'ID' with > > coutour( basiinID == ID, level=0.5) > > Add 'add=TRUE' if you are overlaying this on an existing plot. > > > > Bill Dunlap > > TIBCO Software > > wdunlap tibco.com > > > > On Thu, Aug 4, 2016 at 1:51 AM, Zun Yin <yinzun2...@gmail.com> wrote: > > > >> D > >> ear all, > >> > >> I have a matrix with ID of river basins (integer numbers). Now I want to > >> highlight one river basin in a map by plotting only the border. Like the > >> attached figure. Two river basins are highlighted by polygons. It is > >> created by ferret, but I prefer to implement it by R. Anybody know how > to > >> do it? Thanks a lot. > >> > >> Cheers, > >> > >> Zun Yin > >> > >> ______________________________________________ > >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > >> > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. >
basin.pdf
Description: Adobe PDF document
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.