[R] ggplot: add points selectively to curves

2014-04-02 Thread Michael Friendly
I'm working on an example of plotting predicted probabilities from a proportional odds model. The steps below generate a data frame, plotdat, that I want to plot with ggplot. library(MASS) data(Arthritis, package=vcd) arth.polr - polr(Improved ~ Sex + Treatment + Age, data=Arthritis,

Re: [R] ggplot: add points selectively to curves

2014-04-02 Thread Michael Friendly
Thanks, Dennis Not quite. I need to have the same lines as in the original, using plotdat, but then add the points from your plotdat2 gg - ggplot(plotdat, aes(x = Age, y = Probability, color = Level)) + geom_line(size=2.5) + theme_bw() + xlim(10,80) + #geom_point(color=black,

Re: [R] ggplot: add points selectively to curves

2014-04-02 Thread arun
Hi, May be this helps: gg - ggplot(plotdat, aes(x = Age, y = Probability, color = Level)) + geom_line(size=2.5) + theme_bw() + xlim(10,80) + facet_grid(Sex ~ Treatment, # scales = free, labeller = function(x, y) sprintf(%s = %s, x, y) ) plotdat2 -