I have some problems with ggplot legends, here is my first code with only the legend for corrGenes, which is fine.
gene1=c(1.041,0.699,0.602,0.602,2.585,0.60
The show_guide=TRUE
argument should display the legends for both geom_abline
and stat_smooth
. Try running the below code.
plot= ggplot(data=DF,aes(x=gene1,y=BIME))+
geom_point(aes(colour=corrGenes),size=5)+
geom_abline(aes(colour="best"),intercept=0, slope=1, show_guide=TRUE)+
stat_smooth(aes(colour="data"),method = "lm",se=FALSE, show_guide=TRUE)+
scale_colour_manual(name="Fit", values=c("data"="blue", "best"="black"))+
ylab("BIME normalized counts (log10(RPKM))")+
xlab("gene1 normalized counts (log10(RPKM))")