I have two graphs and I am trying to overlay one on top of the other:
An example of the data frame \"ge\" looks like this. In actuality there are 10 Genes with 200
One way is to add the geom_line
command for the second plot to the first plot. You need to tell ggplot
that this geom is based on a different data set:
ggplot(avg, aes(x=Gene, y=mean)) +
geom_point() +
geom_line() +
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), width=.1) +
geom_line(data = ge, aes(x=Gene, y=Exp, group=Sample, colour="#000099"),
show_guide = FALSE)
The last geom_line
command is for creating the lines based on the raw data.