I have data of the form:
[x] [y1] [y2]
1 0.9 1
2 2.0 2
3 3.1 3
Where (x,y1) are actual values and y2 is a prediction for y1 based on a linear model estimated on another set of data. (x, y1, y2) are in a dataframe DT. How can I make a scatterplot using xyplot that graphs x on the x-axis and y1 and y2 on the y-axis but with different colors?
I was able to do this in ggplot using the following code, but think it looks much less nice than using the xyplot() command, and am wondering if I can use xyplot / lattice in this case.
ggplot(DT, aes(x)) + geom_point(aes(y=y1), color="red") + geom_point(aes(y=y2), color = "green")
Thank you very much in advance!