lesandrop at yahoo.com.br
2009-Jun-25 19:05 UTC
[R] (Resolved) How to draw a line in plot when I know the start point(x1, y1) and end point(x2, y2)?
Thanks Jorge and Marc, I drew the line using the function: segments(x0, y0, x1, y1) Lesandro ________________________________________________________________________ --- Em qui, 25/6/09, Marc Schwartz <marc_schwartz@me.com> escreveu: De: Marc Schwartz <marc_schwartz@me.com> Assunto: Re: [R] How to draw a line in plot when I know the start point(x1, y1) and end point(x2, y2)? Cc: r-help@r-project.org Data: Quinta-feira, 25 de Junho de 2009, 15:38 On Jun 25, 2009, at 1:30 PM, Lesandro wrote:> Hello all, > > How todraw 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 [[elided Yahoo spam]] [[alternative HTML version deleted]]
Seemingly Similar Threads
- 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?
- add trend line to each group of data in: xyplot(y1+y2 ~ x | grp...
- plot y1 and y2 on one graph
- Second y-axis in xyplot (lattice) where y1 and y2 have different ranges