[R] Plotting specific points with type='l'

eric ericstrom at aol.com
Thu Nov 22 20:22:29 CET 2012


I have a dataframe (x) and I'm plotting the 5th column vs the index. I also
have a vector (v) with a few select points that I want to emphasize with a
dot for those points

> head(x)
    period   AP   EU   LA   NA
1 Jan 2007 0.18 0.45 0.19 3.19
2 Feb 2007 0.14 0.48 0.36 3.55
3 Mar 2007 0.14 0.42 0.46 2.61
4 Apr 2007 0.24 0.73 0.32 4.32
5 May 2007 0.19 0.60 0.32 4.40
6 Jun 2007 0.14 0.38 0.32 1.09

v <-c(2,4,7)
plot(x[,5], type='l')

How do I put a solid dot at just the points I want to highlight ? In other
words, a solid dot a the 2nd, 4th, and 7th point on the plot. All other
points according the the type='l'. I tried ... points(x[v,5], pch=19) ...
but the points didn't plot in the right spot. 



--
View this message in context: http://r.789695.n4.nabble.com/Plotting-specific-points-with-type-l-tp4650475.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list