[R] Using ggplot2 geom_path() in a grouped variable
David Winsemius
dw|n@em|u@ @end|ng |rom comc@@t@net
Tue Feb 12 23:02:05 CET 2019
> On Feb 12, 2019, at 2:09 PM, Norberto Hernandez <tavarich.norberto using gmail.com> wrote:
>
> Hi! I am trying to make a scatter/path graph in one variable that is
> divided in two groups (variable Control), but when I use the
> geom_path() option, the line continues from the group one to the group
> two, and I wasn't able to avoid it.I need the path draws over the
> group one and then draws over the group two avoiding the connection
> between the last value of group one and the first value of group two.
>
> This is my code
>
> library(ggplot2)
> plot <- ggplot(data, aes(Pretrend, Outcome)) + geom_point()
> plot + geom_point(aes(colour=factor(Control)))+labs(x="Date",
> y="Cases", title="Intoxication Cases")+geom_path()
>
> Could you please bring be some advice.
The first bit of advice would be to include the unsuccessful code that used geom_path. Otherwise we hav no way of knowing what you gave as the grouping argument. The second bit of advice would be to include a dataset that illustrates the problem. (These are both bits of advice that you should have found in the Posting Guide.
--
David.
> Regards
> Norberto Francisco Hernández
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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