Using Conditional Statements to Change the Color of Data Points

后端 未结 4 832
攒了一身酷
攒了一身酷 2021-01-13 08:39

I have a data set, which I have used to make a scatter plot and I would like to assign three different colors to the data points within three different regions, based on the

4条回答
  •  醉梦人生
    2021-01-13 09:08

    Just use nested ifelses:

    plot(...., col=ifelse(x < 3, "red", ifelse(x > 1549, "purple", "black")))
    

提交回复
热议问题