ggplot2 manually specifying colour with geom_line

As stated by @juba in the comments, you should use scale_colour_manual instead of scale_fill_manual. Moreover, you are trying to plot to many lines and errorbars in one plot. They overlap each other to much and it is therefore hard to distuinguish between the lines/errorbars.

An example with the use of facetting (and some simplification of your code):

ggplot(summary.200.exp2, aes(x=Time, y=Length, group=Genotype)) + 
  geom_line(aes(colour=Bgrnd_All), size =1) +
  geom_errorbar(aes(ymin=Length-se, ymax=Length+se, colour=Bgrnd_All), width=2) +
  scale_x_continuous("Time", breaks=c(0,17,22,41,89)) + 
  scale_colour_manual(values=c(Avalon="#000066",Av_A="#663399",Av_B="#339999",Cadenza="#CC0033",Cad_A="#FF6600",Cad_B="#FF9933"))+
  ylab("leaf segment width (mm)") +
  theme_bw() +
  theme(axis.title = element_text(size=14,face="bold"), axis.text = element_text(size=10)) +
  facet_wrap(~Bgrnd_All, ncol=3)

this gives:

Leave a Comment