[R] How to plot multiple data sets with different colors (also with legend)?

Peng Yu pengyu.ut at gmail.com
Sun Oct 18 22:37:34 CEST 2009


The following commands only show the data in 'y'. I'm wondering how to
show the data in 'x' as well. I also want to add a legend to show that
blue points corresponds to 'x' and yellow points correspond to 'y'.
Could somebody let me know what the correct commands should be?

x=rbind(c(10,11),c(10,11))
y=cbind(-1:0,-1:0)
plot(y,col='yellow')
points(x,col='blue')




More information about the R-help mailing list