title: Change alpha level according to variables
body: <p>I have a data frame like this:</p>
  
  <pre><code>dftt &lt;- data.frame(values = runif(11*4,0,1),
                     col = factor(c(rep(2,4),
                             rep(1,4),
                             rep(5,9*4))),
                     x= rep(1:4, 11*4),
                     group=rep(factor(1:11), each=4)
  )
  </code></pre>
  
  <p>I plot it like this</p>
  
  <pre><code>library(ggplot2)
  ggplot(dftt, aes(x=x, y=values, group=group, color=col)) + geom_line() 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/IvRXJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IvRXJ.png" alt="enter image description here"></a></p>
  
  <p>The blue lines in this plot are just "background" and not as important as red and green, so I want to reduce the alpha level for the blue lines.</p>
  
  <p>I tried this new data frame:</p>
  
  <pre><code>dftt &lt;- data.frame(values = runif(11*4,0,1),
                     col = factor(c(rep(2,4),
                             rep(1,4),
                             rep(5,9*4))),
                     x= rep(1:4, 11*4),
                     group=rep(factor(1:11), each=4),
                     lincol = factor(c(rep(1,9*4), rep(2,2*4)))
  )
  </code></pre>
  
  <p>This data frame has a new variable <code>lincol</code> and I tried to plot it like this:</p>
  
  <pre><code>ggplot(dftt, aes(x=x, y=values, group=group, color=col)) + 
     geom_line(aes(alpha=lincol)) 
  </code></pre>
  
  <p>But this new plot looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/V2mTT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V2mTT.png" alt="enter image description here"></a></p>
  
  <p>The alpha is kind of correct but I lost the red and green. Also the legend is weird.</p>
  
  <p>I also want to set the alpha level specifically to 0.5.</p>