On 02/07/2011 02:15 AM, Jinsong Zhao wrote:
On 2011-2-7 14:15, statmobile wrote:
set.seed(33)
x <- rpois(7,lambda=7)
y <- rpois(7,lambda=5)
cols.x <- c(rep("black",2),rep("red",3),rep("black",2))
cols.y <- c(rep("blue",3),rep("yellow",2),rep("blue",2))
points.x <- c(rep("x",2),rep("O",3),rep("x",2))
points.y <- c(rep(8,3),rep(17,2),rep(8,2))
plot(x,col=cols.x,pch=points.x,type="b",ylim=c(0,15))
points(y,col=cols.y,pch=points.y,type="b")
the following code may give hints...
segments(1:6,x[-7],2:7,x[-1], col = cols.x)
segments(1:6,y[-7],2:7,y[-1], col = cols.y)
regards,
Jinsong
Thanks Jinsong, this works like a charm. I'll need to dive deeper into
the segments function.
______________________________________________
R-help@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.