[R] how can i plot dotted regression line shaped with condition using ggplot

Ista Zahn istazahn at gmail.com
Fri Oct 19 19:41:23 CEST 2012


I may be missing something, but if you want dots you need to ask for
them with geom_point()

Best,
Ista

On Fri, Oct 19, 2012 at 11:46 AM, autumnlin <jialincau at gmail.com> wrote:
> I am plotting ggplot smooth line. I would like to add dots to the regression
> line, the dots are shaped under different condition.
>
> p <- ggplot(data, aes(x = x, y = y,
>                                    shape = assign, linetype = factor(sex)))
>
> p0b <- p+
>   scale_linetype_manual(breaks=c("0","1"), values=c(1,2)) +
>   geom_smooth(aes(shape = assign, linetype = female), method = "lm", se =
> FALSE, size = 1.2)
>
> the dots on the smooth line should be shaped by assign. how can i do it?
> maybe i should add something like
>  scale_shape_manual(values=c(17, 0, 19))
> and whatelse?
> Thanks.
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/how-can-i-plot-dotted-regression-line-shaped-with-condition-using-ggplot-tp4646773.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list