title: How to scale (normalise) values of ggplot2 stat_bin2d within each column (by X axis)
body: <p>I have a ggplot stat_bin2d "heatmap".</p>
  
  <pre><code>library(ggplot2)
  value&lt;-rep(1:5, 1000)
  df&lt;-as.data.frame(value)    
  df$group&lt;-rep(1:7, len=5000)
  df&lt;-df[sample(nrow(df), 3000), ]
  ggplot(df, aes(factor(group), factor(value))) +stat_bin2d()
  </code></pre>
  
  <p>I have tried to add fill to aes:</p>
  
  <pre><code>aes(factor(group), factor(value),fill = (..count..)/mean(..count..))
  </code></pre>
  
  <p>as a way to mimic ..density.. (not accepted) does not seem to be accepted, but it is not what I am wanting - it seems to divide by the sum of the counts for the whole df. I want the count of values in each group (by x axis) normalised by the mean (or sum, or other stat) within the group. unfortunately, sum(..count..) seems to give the sum of the whole df, not only of the column. </p>