I am able to plot a scatter plot and color the points based on one criteria, i.e. I can color all points >=3 as red and the remainder as black.
I would love to be able to color points in this fashion:
=3 color red
- <=1 color blue
- The rest as black
The code I have below completes step 1 and 3 but I am not sure how to incorporate the second argument of step 2
data<- read.table('sample_data.txtt', header=TRUE, row.name=1)
pos<- data$col_name1
cn<- data$col_name2
plot(pos,cn, ylim=c(0,5), col="blue")
plot(pos,cn, col=ifelse(cn>=3,"red","black"), ylim=c(0,10))
Any help would be great!!!
Thanks in advance
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…