Lesandro
2009-Jun-25 18:30 UTC
[R] How to draw a line in plot when I know the start point(x1, y1) and end point(x2, y2)?
Hello all, How to draw a line in plot when I know the start point(x1,y1) and end point(x2,y2)? I need make this as additional information in the graph: plot(wl2[[1]],wl2[[2]]) I think that is possible make this with the function abline(), is possible? I looked the function lines() too, but don't understand as make. Thanks! Lesandro Veja quais são os assuntos do momento no Yahoo! +Buscados [[alternative HTML version deleted]]
Jorge Ivan Velez
2009-Jun-25 18:35 UTC
[R] How to draw a line in plot when I know the start point(x1, y1) and end point(x2, y2)?
Dear Lesandro, Take a look at ?segments HTH, Jorge On Thu, Jun 25, 2009 at 2:30 PM, Lesandro <lesandrop@yahoo.com.br> wrote:> Hello all, > > How to draw a line in plot when I know the start point(x1,y1) and end > point(x2,y2)? I need make this as additional information in the graph: > > plot(wl2[[1]],wl2[[2]]) > > I think that is possible make this with the function abline(), is possible? > I looked the function lines() too, but don't understand as make. > > > Thanks! > Lesandro > > > > Veja quais são os assuntos do momento no Yahoo! +Buscados > > [[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. > >[[alternative HTML version deleted]]
Marc Schwartz
2009-Jun-25 18:38 UTC
[R] How to draw a line in plot when I know the start point(x1, y1) and end point(x2, y2)?
On Jun 25, 2009, at 1:30 PM, Lesandro wrote:> Hello all, > > How to draw a line in plot when I know the start point(x1,y1) and > end point(x2,y2)? I need make this as additional information in the > graph: > > plot(wl2[[1]],wl2[[2]]) > > I think that is possible make this with the function abline(), is > possible? I looked the function lines() too, but don't understand as > make. > > > Thanks! > LesandroSee ?segments which does just what you are looking for. lines() is more designed for a series of connected lines (eg. a polygon) rather than a single line segment. abline() can draw a straight line, at a given vertical or horizontal position, or if given a linear model object, the fitted line. HTH, Marc Schwartz
Seemingly Similar Threads
- (Resolved) How to draw a line in plot when I know the start point(x1, y1) and end point(x2, y2)?
- How to force R to print 2 decimal places in column of a data.frame?
- How to order an data.table by values of an column?
- help with loop
- (performance) time in Windows vs Linux