Colour points in a plot differently depending on a vector of values
Here's a solution using base R graphics:
#Some sample datax <- runif(100)dat <- data.frame(x = x,y = x^2 + 1)#Create a function to generate a continuous color paletterbPal <- colorRampPalette(c('red','blue'))#This adds a column of color values# based on the y valuesdat$Col <- rbPal(10)[as.numeric(cut(dat$y,breaks = 10))]plot(dat$x,dat$y,pch = 20,col = dat$Col)