My story: I need to plot a 2-D dimensional plot with the points colored by a third variable which is discrete and valued as integers (20 possible values).
Finding so far: All the code that I find first converts the third variable to factors and then color the points with the factor levels. For instance,
p <- qplot(mpg, wt, data = mtcars, colour = factor(cyl))
p + scale_colour_manual(values = c("red","blue", "green"))
Question: I am confused from here because I am not sure what the actual value (of my original third variable) is corresponding to each level of the factors. Are the values in the legend the actual values or the levels?
Is there another way to do it without converting my variable to a factor variable?