使用绘图功能时,是否可以自定义更改散点图中的颜色绘图点?

我的数据看起来像这样:

x = A,A,B,C,D,E,E,F,G y = 1、0、2、3、4、5、0、6、7

How do I have every alternate x-axis data point a different colour? For example, in my data, I would like to have the A, C, E and G points one colour, B, D, F another and then have the points where the value is 0 a third colour? I've used pch = and col= to change the colour and shape of everything, but is it possible to change specific points?

还是我必须在同一图上绘制两个不同的图,然后更改每个图的颜色,然后为零设置第三条规则?唯一的问题是,由于我的变量不是数字变量,并且数据需要交替显示,因此我似乎无法弄清楚如何绘制它。