title: How to plot a legend for the color coded density scatter plot?
body: <p>I am making a scatter plot with color coded density with this code :</p>
  
  <pre><code>d1 = densCols(newData_cut, 
            colramp = colorRampPalette(c("navy 
           blue","yellow","firebrick","firebrick"), 
                                       space = "Lab"))
  
  ggplot(newData_cut) + 
     geom_point(aes(x=green, y= blue, col = d1), size = 1) +
     xlim(0, 0.4)+
     ylim(0,2)
  </code></pre>
  
  <p>But when I get the image it looks like this: </p>
  
  <p><a href="https://i.stack.imgur.com/IX8Tr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IX8Tr.png" alt=""></a></p>
  
  <p>Can somebody help me to plot a proper legend with a color representing the count / density of the points? </p>
  
  <pre><code>&gt; dput(head(newData_cut))
  structure(list(green = c(0, 0.229804, 0, 0, 0, 0), blue = c(0.080264, 
  0.204474, 0.04059, 0.040284, 0.042421, 0.041505), width = c(1317, 
  4529, 1, 10, 23, 5)), .Names = c("green", "blue", "width"), row.names = 
  c(NA, 
  6L), class = "data.frame")
  </code></pre>