[R] Fwd: Re: Creating "Envelope" around a plot

William Dunlap
Mon, 02 Nov 2015 17:35:13 -0000

> summing the Euclidean distances between points in the strands
> ... if two one strand lies within the "envelope" of another I can
set
them together

Use the max instead of the sum.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Mon, Nov 2, 2015 at 9:29 AM, WRAY NICHOLAS <nicholas.wray at
ntlworld.com>
wrote:

> Hi Bill I have been doing exactly that, ie summing the Euclidean distances
> between points in the strands   Although with small sets of strands this
> technique allows me to group the strands into various sets, which I can
> assume are the same, unfortunately once I have a larger number of strands
> the distances between groups become on the same order as the distances
> within groups as so it's no longer clear cut.  I have tried various
> approaches, include a kind of Monte Carlo sampling to create the distinct
> groups but the best approach seems to be a kind of "kinship"
idea, where if
> two one strand lies within the "envelope" of another I can set
them
> together.  But as said, creating the envelope in R is not straightforward
>
> Thanks Nick
>
> On 02 November 2015 at 16:51 William Dunlap <wdunlap at tibco.com>
wrote:
>
> Instead of computing the envelopes (of various radii) of paths and seeing
> if they intersect
> you could compute distances between paths and seeing if they are smaller
> than a given
> distance. Computing the distance between 2 polylines is not difficult,
> although computing
> it quickly for very long sequences of line segments is more difficult.
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> On Mon, Nov 2, 2015 at 7:19 AM, WRAY NICHOLAS < nicholas.wray at
ntlworld.com>
> wrote:
>
>
> > ---------- Original Message ----------
> > From: WRAY NICHOLAS < nicholas.wray at ntlworld.com>
> > To: Duncan Murdoch < murdoch.duncan at gmail.com>, r-help
> > <r-help at missing_domain>
> > Date: at
> > Subject: Re: [R] Creating "Envelope" around a plot
> >
> >
> > Hi Dennis again, I see what you're getting at and it looks rather
groovy
> > but unfortunately what I actually need is the vector of the points on
> the
> > boundary (the graphics just being a way of checking that
everything's as
> it
> > should be) and so it rather looks like I need to do a lot of
calculating
> of
> > orthogonal vectors along straight stretches and circles round peaks
> >
> > I'm looking to do an algorithmic filtration of strands which lie
within
> > the "envelope" of other strands -- your method would allow
visual "by
> hand"
> > inspection but unfortunately I've got hundreds of strands to
compare!
> >
> > But thanks again -- useful thoughts Nick
> >
> > > >
> > > On 02 November 2015 at 15:03 Duncan Murdoch
> > > < murdoch.duncan at gmail.com> wrote:
> > >
> > >
> > > On 02/11/2015 7:33 AM, WRAY NICHOLAS wrote:
> > > > Hi I am plotting various strands of information, and I want
to
> > > > create an
> > > > "envelope" around each line, so that the locus of
the envelope is
> > > > the boundary
> > > > points no more than a fixed maximum distance from the
plotted
> > > > line, a bit like
> > > > drawing a larger rectangle with paralle sides and curved
compass
> > > > corners around
> > > > a smaller rectangle. Obviously I can work out how to do this
in
> > > > code
> > > > (eventually) but I suspect it would take me a while and i
was
> > > > wondering whether
> > > > there was some R function which I don't know about which
creates
> > > > sets of of
> > > > points at a given maximal distance
> > > >
> > > > the lines are simple vectors, ie like this noddy example
> > > >
> > > > veca<-c(4,3,6,5,7,3,2,3,3,6,8,7)
> > > > plot(veca,type="l",lwd=2)
> > > >
> > > > then I want to plot the locus of the boundary of all points
no
> > > > more than (say) 1
> > > > unit from the line I imagine that one would have to provide
a
> > > > larger set of
> > > > interpolated points between the actual points of veca, but I
can
> > > > do that no
> > > > problem
> > > >
> > > > I'd be grateful if anyone out there in the R-ethervoid
has any
> > > > ideas
> > >
> > > The graphics system will do this for you automatically if your
> > > coordinate system has the same scale in x and y, and you use a
> > > really
> > > huge line width. For example,
> > >
> > > veca<-c(4,3,6,5,7,3,2,3,3,6,8,7)plot(veca, lwd=150,
col="gray",
> > > type="l")lines(veca, lwd=2)
> > >
> > >
> > > If you want to be 1 unit away in user coordinates and the x and y
> > > scales
> > > are different, it will be a lot harder.
> > >
> > > Duncan Murdoch
> > >
> > > >
> > >
> >
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.