title: R: ggplot better gradient color
body: <p>I am using ggplot to plot Proportional Stacked Bar plot. And the Plot I am getting is something like this:
  <img src="https://i.stack.imgur.com/LZSV6.png" alt="enter image description here"></p>
  
  <p>And this is the self written function I am using:</p>
  
  <pre><code>df &lt;- data.frame(id=letters[1:3],val0=1:3,val1=4:6,val2=7:9, val3=2:4, val4=1:3, val5=4:6, val6=10:12, val7=12:14)
  
  PropBarPlot&lt;-function(df, mytitle=""){
     melteddf&lt;-melt(df, id=names(df)[1], na.rm=T)
     ggplot(melteddf, aes_string(x=names(df)[1], y="value", fill="variable")) + 
       geom_bar(position="fill") + 
       theme(axis.text.x = element_text(angle=90, vjust=1)) + 
       labs(title=mytitle)
  }
  
  print(PropBarPlot(df))
  </code></pre>
  
  <p><strong>Here <code>val4</code> and <code>val5</code> are not very different.</strong></p>
  
  <p>But due to colors some of them are not distinguishable. Can someone tell me how to choose better colors so that they are differentiable?</p>
  
  <p>Thanks.</p>