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

arun smartpink111 at yahoo.com
Thu Nov 22 22:33:44 CET 2012


Hi,
If you wanted to emphasize the select points from the 5th column:
You could try:
plot(x[,5], type='l')
 points(dat2[c(2,4,7),5],pch=19)
A.K.




----- Original Message -----
From: eric <ericstrom at aol.com>
To: r-help at r-project.org
Cc: 
Sent: Thursday, November 22, 2012 2:22 PM
Subject: [R] Plotting specific points with type='l'

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.

______________________________________________
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.





More information about the R-help mailing list