[R] how to adding colors to data points in scatter plot in R?

2009-05-23 Thread Tim LIU
Does anybody know how to adding colors to data points in scatter plot in R? I have the following R data frame - Voter_Name, Education_years, Income, Registered Ricky, 18, 4, Y Lisa, 20, 34000, N Jon, 10, 35000, Y ... I am doing a scatter plot in R for those data points - Income vs.

Re: [R] how to adding colors to data points in scatter plot in R?

2009-05-23 Thread ONKELINX, Thierry
: zaterdag 23 mei 2009 7:18 Aan: r-help@r-project.org Onderwerp: [R] how to adding colors to data points in scatter plot in R? Does anybody know how to adding colors to data points in scatter plot in R? I have the following R data frame - Voter_Name, Education_years, Income, Registered Ricky, 18

Re: [R] how to adding colors to data points in scatter plot in R?

2009-05-23 Thread Matthieu Dubois
Simply use the col paramater, with a factor to index the colors. Example: # generate some data x - rnom(100) y - rnorm(x) z - as.factor(rbinom(x,1,0.5)) # plot plot(x,y, col=c('red','blue')[z]) HTH, Matthieu __ R-help@r-project.org mailing list