On Tue, Jan 29, 2013 at 7:58 PM, Antonio P. Ramos
<ramos.gra...@gmail.com> wrote:
>
> Hi all,
>
> I use the following to generate the attached graph.
>
>>
>> qplot(data=subset(w1,ncase>10),y=death.rate,x=maternal_age,group=tablename_x,geom="line",ylim=c(0,.4))
>> +
> + opts(title="Under 2 deaths rates and Maternal Age by Survey whithin
> Years \n(minum number of cases by age-survey-year group is 10 children) ") +
> + geom_smooth(aes(group=1)) + facet_wrap(~B2)
It might look a little better if you used alpha transparency on the
individual lines and maybe a somewhat thinner line width.
>
> In addition to this graph, I wonder if there is any easy to have all
> smoothers in only one plot, without displaying the raw data. I can send the
> data, if needed.
Of course :) Don't facet and use tablename_x as the grouping variable;
you probably want to use it as the color aesthetic, too. Given the
number of smooths involved, I'd suggest dispensing with the confidence
bands. Something like
qplot(data=subset(w1,ncase>10),
y=death.rate, x=maternal_age, group=tablename_x, color = tablename_x,
geom="smooth",ylim=c(0,.4))
or
ggplot(subset(w1, ncase > 10),
aes(y=death.rate, x=maternal_age, group=tablename_x, color =
tablename_x) ) +
geom_smooth(se = FALSE) +
ylim(0, 4)
I don't use qplot() very often so I don't know offhand how you'd set
se = FALSE inside the geom_smooth() call.
Dennis
>
> X maternal_age B2 tablename_x death.rate ncase
> 1 1 5 1971 IABR23FL 1.0 1
> 2 2 7 1973 IABR23FL 0.0 1
> 3 3 7 1975 KEBR33FL 0.0 1
> 4 4 7 1980 TGBR31FL 0.0 1
> 5 5 8 1970 TGBR31FL 1.0 1
> 6 6 8 1975 TGBR31FL 0.5 2
>
> Thanks!
>
> Antonio Pedro.
>
> --
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ggplot2+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Thanks for your reply. Unfortunately, the code you kindly provided is not doing the job: instead it is producing different smoothers. To see this consider the plots for these different pieces of code:
As we can see, the smoothers from figure one are NOT the same as two and three. Why?
--