How to give color to each class in scatter plot in R?

In a dataset, I want to take two attributes and create supervised scatter plot. Does anyone know how to give different color to each class ?

I am trying to use col == c("red","blue","yellow") in the plot command but not sure if it is right as if I include one more color, that color also comes in the scatter plot even though I have only 3 classes.

Thanks

Leave a Comment