title: how to specify color of lines and points in ecdf ggplot2
body: <p>I have a set of data that is tough to visualize, but I think an ECDF with a couple of points and lines added to it will do the trick. I am able to plot things the way that I want; my problem is coloring things correctly.</p>
  
  <p>I have the following code, which puts all of the right lines and points on the plot, but now I would like to properly color and label everything. I've pored over multiple articles and tried a hundred things, but can't get it right. Do i need to format my data differently? </p>
  
  <p>My vision for the legend is something like this:</p>
  
  <ul>
  <li>dashed line = b</li>
  <li>solid line  = a</li>
  <li>red         = s</li>
  <li>blue        = d</li>
  <li>dot         = s.mean</li>
  </ul>
  
  <p>code for generating an example plot is here:</p>
  
  <pre><code>require(ggplot2)
  require(reshape2)
  
  s.a = rnorm(100)*100
  s.b = rnorm(100)*100+50
  d.a = -35
  d.b = 20
  sdata = data.frame(cbind(s.a,s.b))
  ddata = data.frame(cbind(d.a,d.b))
  sdata.m = melt(sdata)
  ddata.m = melt(ddata)
  
  ggplot(sdata.m, aes(x=value, color=variable)) +
    geom_vline(data=ddata.m,
               aes(xintercept = value,
                   color=variable),
               linetype = 2,
               size=2) + 
    stat_ecdf(size=1)+
    labs(title = 'plotTitle',
         color='colorLegendTitle') +
    xlab('xLabel') +
    ylab('yLabel')+
    theme_bw(30) +
    theme(
      legend.position=c(.8, .2),
      legend.box="horizontal",
      text=element_text(family="Times"),
      legend.key.size = unit(1,"cm")) +
    geom_point(x=mean(sdata.m$value[sdata.m$variable=="s.a"]),y=.5,
               size = 5) +
    geom_point(x=mean(sdata.m$value[sdata.m$variable=="s.b"]),y=.5,
               size = 5)
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/76pX6.png" alt="enter image description here">
  Some context on the data I'm plotting: I have stochastic datasets (s) and deterministic sets (d); each stochastic set will have hundreds of values, while the deterministic sets only have a single value. So in my plot, I'm comparing the distribution of stochastic data (solid lines), and the mean of stochastic data (dots) with the deterministic values (dashed lines). For both the stochastic and deterministic datasets, there are two 'cases' (a) and (b). <strong>I would like all (a) and (b) data to share the same color.</strong></p>
  
  <p>This seems like it should be easy with aes and color/linetype/geom mappings, but I can't figure it out.</p>
  
  <p>Thanks in advance.</p>