I try to plot a graph with ggplot2 using differents levels of fill and group in order to (i) obtain two distinct sets of points corresponding to two variable and (ii) connecting these sets of points by geom_line but only for the first four levels (so without the last fifth level for both sets.
Here is the link to have the data : https://www.wetransfer.com/downloads/39ddf5c0cb4c2d9db8ea66354bcf19e220160621081124/3f0cc767ba2b29ea8f2d7bbf7d3d11ff20160621081124/0b7845
There are 5 column : Stages (x), Facet (useless here), variable (the two sets of points), value (y), and Grp (for connecting only the first four levels.
And my lines code :
plot <- ggplot(df,aes(x=Stages,y=value,fill=variable),group=1) + geom_line(aes(fill=variable,group=Grp),stat='summary',fun.y="mean") +
stat_summary(aes(fill=variable,fun.data = "mean", geom = "errorbar"))
I tried many combinations but - with this code - i can plot the two sets of points and only one overall line.
How can constraint the drawing of the line for both the two set of points and excluding the last level of the x factor "E/O" ?
Thanks a lot for your answer !
Loïs.