The usual culprit in this case is that your x-variable is a factor, so
you need to use the group aesthetic to work around it.
Sure enough, p1 and p2 are both factors
> str(mdf.mean)
'data.frame': 300 obs. of 5 variables:
$ p1 : Factor w/ 4 levels "p1.100","p1.20",..: 1 1 1 1 1 1 1 1 1 1 ...
$ p2 : Factor w/ 5 levels "p2.10","p2.100",..: 1 1 1 1 1 1 1 1 1 1 ...
$ p3 : Factor w/ 5 levels "group.1","group.2",..: 1 1 1 2 2 2 3 3 3 4 ...
$ p4 : Factor w/ 3 levels "p4.0.2","p4.0.5",..: 1 2 3 1 2 3 1 2 3 1 ...
$ Mean: num 7.49 8.51 9.5 8.5 9.49 ...
Assuming you wanted separate lines by levels of p1,
ggplot(mdf.mean, aes(x=p2, y=Mean, colour=p1)) + geom_point() +
geom_line(aes(group = p1)) + facet_grid(p3 ~ p4, scales = "free_y")
You should also check out the 'group = 1' trick. A good example of its
use is found on p. 51 of Hadley's book (section 4.5.3).
HTH,
Dennis
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
thank you very much, that clarified a lot. I try to put it in the "toolbox" of things I learned about ggplot2 recently. I also checked out "group=1" :-)
ggplot(mdf.mean, aes(x=p2, y=Mean, colour=p1)) + geom_point() +
geom_line(aes(group=1)) + facet_grid(p3 ~ p4, scales = "free_y")
The only thing I have left to figure out is how to freely specify the order in which the groups appear.
Cheers,
Marius