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
You can define a vector of colors and pass it to the col argument of plot. Something like this :
col
plot
colors <- rep("black", length(x)) colors[x<3] <- "red" colors[x>1549] <- "pink" plot(x, y, xlab="chr X position (Mb)", ylab="Diversity", pch=16, cex =0.7, col = colors)