[R] Using ggplot2 geom_path() in a grouped variable

Norberto Hernandez t@v@r|ch@norberto @end|ng |rom gm@||@com
Tue Feb 12 21:09:52 CET 2019

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

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.
Norberto Francisco Hernández

More information about the R-help mailing list