Conor Ryan
2013-Sep-27 18:56 UTC
[R] Plot lines whose angle and length depict vector quantities
I am trying to plot points on a map for each ship locations (lat/long), where each point is a line whose angle (degrees) denotes ships heading and whose line length denotes it's speed. Unfortunately arrows(); p.arrows (sfsmisc) and ms.arrows (TeachingDemos) require start and end coordinates but I only have a single coordinate and an angle to work with. Can you suggest any other packages or commands that might allow me to plot this? Alternatively, can anyone suggest a method of making 'angle' a vector quantity when using the arrows function? Any advice would be much appreciated! [[alternative HTML version deleted]]
Sarah Goslee
2013-Sep-27 19:44 UTC
[R] Plot lines whose angle and length depict vector quantities
It's a straightforward trigonometry problem, isn't it? On Fri, Sep 27, 2013 at 2:56 PM, Conor Ryan <miolmor at gmail.com> wrote:> I am trying to plot points on a map for each ship locations (lat/long), > where > each point is a line whose angle (degrees) denotes ships heading and whose > line length denotes it's speed. Unfortunately arrows(); p.arrows (sfsmisc) > and ms.arrows (TeachingDemos) require start and end coordinates but I only > have a single coordinate and an angle to work with. Can you suggest any > other packages or commands that might allow me to plot this? Alternatively, > can anyone suggest a method of making 'angle' a vector quantity when using > the arrows function? Any advice would be much appreciated! >-- Sarah Goslee http://www.functionaldiversity.org
Greg Snow
2013-Sep-27 21:07 UTC
[R] Plot lines whose angle and length depict vector quantities
The ms.arrows along with my.symbols in the TeachingDemos package does not require start and end points, it takes a single point along with the angle and length (and the length can be a single constant to have all the arrows the same length, or a variable to have different lengths). You can also set an adjustment parameter to decide if the arrows should be centered on the point, start at the point, or end at the point. The ms.arrows function was designed for exactly what you describe. On Fri, Sep 27, 2013 at 12:56 PM, Conor Ryan <miolmor@gmail.com> wrote:> I am trying to plot points on a map for each ship locations (lat/long), > where > each point is a line whose angle (degrees) denotes ships heading and whose > line length denotes it's speed. Unfortunately arrows(); p.arrows (sfsmisc) > and ms.arrows (TeachingDemos) require start and end coordinates but I only > have a single coordinate and an angle to work with. Can you suggest any > other packages or commands that might allow me to plot this? Alternatively, > can anyone suggest a method of making 'angle' a vector quantity when using > the arrows function? Any advice would be much appreciated! > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > 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. >-- Gregory (Greg) L. Snow Ph.D. 538280@gmail.com [[alternative HTML version deleted]]
Jim Lemon
2013-Sep-28 00:57 UTC
[R] Plot lines whose angle and length depict vector quantities
On 09/28/2013 04:56 AM, Conor Ryan wrote:> I am trying to plot points on a map for each ship locations (lat/long), > where > each point is a line whose angle (degrees) denotes ships heading and whose > line length denotes it's speed. Unfortunately arrows(); p.arrows (sfsmisc) > and ms.arrows (TeachingDemos) require start and end coordinates but I only > have a single coordinate and an angle to work with. Can you suggest any > other packages or commands that might allow me to plot this? Alternatively, > can anyone suggest a method of making 'angle' a vector quantity when using > the arrows function? Any advice would be much appreciated! >Hi Conor, Try the vector.field function (plotrix). Jim