+1  A: 

well after posting the question I ran across this R Help thread that may have helped me. It looks like I can do this:

 pg + geom_line(data=dd,aes(x_value, Actual_value,group=State_CD), colour="green")

is that a good way of doing things? It odd to me because adding the second item has a totally different syntax than the first.

JD Long
Note that you only have to change things from the defaults that you set in the ggplot() part. In your case you only have to set the new y-value and the colour.ggplot(dd, aes(x= x_value, y = Predicted_value)) + geom_point(shape = 2) + facet_wrap(~ State_CD) + opts(aspect.ratio = 1) + geom_line(aes(yActual_value, colour="green")
Thierry
+1  A: 

you might just want to change the form of your data a little bit, so that you have one y-axis variable, with an additional factor variable indicating whether it is a predicted or actual variable.

Is this something like what you are trying to do?

dd<-data.frame(type=rep(c("Predicted_value","Actual_value"),20),y_value=rnorm(40),
       x_value=rnorm(40),State_CD=rnorm(40)>0)
qplot(x_value,y_value,data=dd,colour=type,facets=.~State_CD)
Ian Fellows
ahhh.. I think that's what the examples in the ggplot docs are doing. That certainly helps my thinking
JD Long
+1  A: 

I'm sure Hadley will have a better answer, but - the syntax is different because the ggplot(dd,aes()) syntax is (I think) primarily intended for plotting just one variable. For two, I would use:

ggplot() + 
geom_point(data=dd, aes(x_value, Actual_value, group=State_CD), colour="green") + 
geom_point(data=dd, aes(x_value, Predicted_value, group=State_CD), shape = 2) + 
facet_wrap(~ State_CD) + 
opts(aspect.ratio = 1)

Pulling the first set of points out of the ggplot() gives it the same syntax as the second. I find this easier to deal with because the syntax is the same and it emphasizes the "Grammar of Graphics" that is at the core of ggplot2.

Matt Parker
+8  A: 
Jonathan Chang