Didzis gets a response to the answer; I was able to adapt my code and get to the final product that I was looking for:
ggplot(sdata.m, aes(x=value, color=variable,linetype=variable,shape=variable))+ stat_ecdf(size=1)+ geom_vline(data=ddata.m, aes(xintercept = value,color=variable,linetype=variable,shape=variable), size=2) + geom_point(aes(x=mean(sdata.m$value[sdata.m$variable=="sa"]), color="samean",linetype="samean",shape="samean", y=.5),size = 5) + geom_point(aes(x=mean(sdata.m$value[sdata.m$variable=="sb"]), color="sbmean",linetype="sbmean",shape="sbmean", y=.5),size = 5) + scale_shape_manual(breaks=c("da","db","sa","samean","sb","sbmean"), values=c(16,16,16,16,16,16)) + scale_color_manual(breaks=c("da","db","sa","samean","sb","sbmean"), values=c("blue","red","blue","blue","red","red"))+ scale_linetype_manual(breaks=c("da","db","sa","samean","sb","sbmean"), values=c(2,2,1,0,1,0))+ guides(color=guide_legend(override.aes=list(shape=c(NA,NA,NA,16,NA,16))))
A few things I learned:
- When adding breaks / values to scale_manual, it is important to use the alphabetical order.
- when all parameters (line type / shape / color) are matched with the same variable "variable", you can get everything in one legend
- when redefining things using manual scales, you need to make one from each scale, and then redefine the "guides" if necessary
Thanks again Didzis. Another life saved.