I know that the color argument inside aes function treats the string as different factors for example
colors = colorRampPalette(c("red","blue"))(3))
#colors is a list of hex code for colors ranging from red to blue
dt = data.table(x=(1,2,3),y=(3,2,1), level=(1,2,3))
ggplot(dt)+geom_point(aes(x=x,y=y,color = colors[level]))
The above code will not use the hex codes as inputs for colors but just different factors. Is there any way the color parameter inside aes can actually use the hex codes?