0

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.

aosmith
  • 34,856
  • 9
  • 84
  • 118
Loïs
  • 1
  • 1
  • I couldn't access your dataset easily (the site wants me to accept some terms and conditions). Consider adding a small example directly to your question instead using `dput`. See [here](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for ideas on how to include a dataset in your question. – aosmith Jun 22 '16 at 15:16
  • Thanks. I will do so if i don't find another solution. – Loïs Jun 24 '16 at 14:33

0 Answers0