[R] plotting with a symbol on every nth point

Carl Witthoft carl at witthoft.com
Sun Oct 23 20:39:35 CEST 2011


If you just want the same symbol at each point, you could use Weylandt's 
approach, tho' personally I think it's tidier to create a new vector

x10 <- x[seq(1,length(x),by=10)]  and plot that.

If you would like a different symbol at each point, then take a look at 
?text.




<quote>
From: R. Michael Weylandt <michael.weylandt_at_gmail.com>
Date: Fri, 21 Oct 2011 17:21:34 -0400
Try something like this:

plot(x,type="o", pch = c(5,rep(NA,9)))

for, e.g., every 10th point.

Michael Weylandt

On Fri, Oct 21, 2011 at 5:18 PM, zugi young <zugi.young_at_gmail.com> 
wrote:
 > Hi,
 >
 > I would like to produce a plot with a symbol on every nth point in a 
time
 > series data, like the one in the following:
 >
 > http://www.phon.ucl.ac.uk/home/yi/ProsodyPro/EnglishFocus.png
 >
 > x <- seq(-100,1000,25)
 > plot(x,type="l")
 >
 > Could someone help me out with the above example?

-- 

Sent from my Cray XK6
"Pendeo-navem mei anguillae plena est."



More information about the R-help mailing list