Hi I want to plot an x,y plot something like an scatter plot. I always have the same doubt, were is the last point of my file? Imagine it is a time series so I want the last point to indicate with an arrow (but athomatically if posible). Someone knows if it is posible? Could it be posible to add additional arrows (with a small square with text?) I hope you can comprehead me? I suppose you will say: An arrow? Which width?size? I first need to see how it looks and if it is posible. Many thanks in advance¡¡¡ [[alternative HTML version deleted]]
Hi, Here are two options. I would colour the last point differently, or make it a different shape rather than using an arrow, but its your choice. x <- 1:10 y <- 1:10 #With an arrow plot(x, y) arrows(x0 = x[length(x)], y0 = y[length(y)] - 1, x1 = x[length(x)], y1 = y[length(y)] - .5) #Overwriting the point with an 'x' #note this is controlled by the pch = 4 argument plot(x, y) points(x = x[length(x)], y = y[length(y)], pch = 4, cex = 1.5, col = "blue") see ?arrows ?plot ?points for documentation. Cheers, Josh On Tue, Jul 27, 2010 at 2:06 PM, Trying To learn again <tryingtolearnagain at gmail.com> wrote:> Hi I want to plot an x,y plot something like an scatter plot. > > I always have the same doubt, were is the last point of my file? > > Imagine it is a time series so I want the last point to indicate with an > arrow (but athomatically if posible). > > Someone knows if it is posible? > > Could it be posible to add additional arrows (with a small square with > text?) > > I hope you can comprehead me? > > I suppose you will say: An arrow? Which width?size? I first need to see how > it looks and if it is posible. > > Many thanks in advance??? > > ? ? ? ?[[alternative HTML version deleted]] > > > ______________________________________________ > R-help at 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. > >-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/
It won't happen automatically unless you make it do so yourself. Fortunately this is not hard. See, ?arrows -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Trying To learn again Sent: Wednesday, 28 July 2010 7:07 AM To: r-help at r-project.org Subject: [R] Add an arrow to a plot Hi I want to plot an x,y plot something like an scatter plot. I always have the same doubt, were is the last point of my file? Imagine it is a time series so I want the last point to indicate with an arrow (but athomatically if posible). Someone knows if it is posible? Could it be posible to add additional arrows (with a small square with text?) I hope you can comprehead me? I suppose you will say: An arrow? Which width?size? I first need to see how it looks and if it is posible. Many thanks in advance??? [[alternative HTML version deleted]]
In addition to the arrows function, look at the my.symbols and ms.arrows functions in the TeachingDemos package, this is a wrapper around the arrows function, but may be a more natural interface for what you want. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Trying To learn again > Sent: Tuesday, July 27, 2010 3:07 PM > To: r-help at r-project.org > Subject: [R] Add an arrow to a plot > > Hi I want to plot an x,y plot something like an scatter plot. > > I always have the same doubt, were is the last point of my file? > > Imagine it is a time series so I want the last point to indicate with > an > arrow (but athomatically if posible). > > Someone knows if it is posible? > > Could it be posible to add additional arrows (with a small square with > text?) > > I hope you can comprehead me? > > I suppose you will say: An arrow? Which width?size? I first need to see > how > it looks and if it is posible. > > Many thanks in advance??? > > [[alternative HTML version deleted]]