Hi,
I am using ggplot2 to with the following code:

gmathk2 <-
qplot(time,math,colour=Kids,data=kids.ach.lm.k5,geom="smooth",method="lm",formula=y~ns(x,1))
+ opts(title="Smoother Plot: Math K-5") + xlab("Time") + ylab("Math") +
scale_colour_brewer(pal="Set1"); gmathk2

This plots all the smoother for all the x values. What I'd like to do is
plot the smoother for the x values that are only greater than or equal to 0.
I don't want this:

gmathk2 <-
qplot(time,math,colour=Kids,data=kids.ach.lm.k5,geom="smooth",method="lm",formula=y~ns(x,1))
+ opts(title="Smoother Plot: Math K-5") + xlab("Time") + ylab("Math")  +
scale_colour_brewer(pal="Set1") + xlim(0,50); gmathk2

Because adding xlim seems to throw away the data below 0 when calculating
the smoother. What I want it to do is have ggplot2 give me the same graph as
the first command but just not plot the part of the smoother that is below
0.

Thanks,
Chris

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to