title: Normalizing y-axis in histograms in R ggplot to proportion
body: <p>I have a very simple question causing me to bang my head on the wall.</p>
  
  <p>I would like to scale the y-axis of my histogram to reflect the proportion (0 to 1) that each bin makes up, instead of having the area of the bars sum to 1, as using y=..density.. does, or having the highest bar be 1, as y=..ncount.. does.</p>
  
  <p>My input is a list of names and values, formatted like so:</p>
  
  <pre><code>name    value
  A   0.0000354
  B   0.00768
  C   0.00309
  D   0.000123
  </code></pre>
  
  <p>One of my failed attempts:</p>
  
  <pre><code>library(ggplot2)
  mydataframe &lt; read.delim(mydata)
  ggplot(mydataframe, aes(x = value)) +
  geom_histogram(aes(x=value,y=..density..))
  </code></pre>
  
  <p>This gives me a histogram with area 1, but heights of 2000 and 1000:</p>
  
  <p><a href="https://i.imgur.com/nhDcF.png" rel="noreferrer"><img src="https://i.imgur.com/nhDcF.png" alt="try"></a></p>
  
  <p>and y=..ncount.. gives me a histogram with highest bar 1.0, and rest scaled to it:</p>
  
  <p><a href="https://i.imgur.com/wog8K.png" rel="noreferrer"><img src="https://i.imgur.com/wog8K.png" alt="try"></a></p>
  
  <p>but I would like to have the first bar have a height of 0.5, and the other two 0.25.</p>
  
  <p>R does not recognize these uses of scale_y_continuous either.</p>
  
  <pre><code>scale_y_continuous(formatter="percent")
  scale_y_continuous(labels = percent)
  scale_y_continuous(expand=c(1/(nrow(mydataframe)-1),0)
  </code></pre>
  
  <p>Thank you for any help.</p>