how to put exact number of decimal places on label ggplot bar chart
<p>How can I specify the exact number of decimal places on <code>ggplot</code> bar chart labels?</p>

<p>The data:</p>

<pre><code>strefa  &lt;- c(1:13)
a       &lt;- c(3.453782,3.295082,3.137755,3.333333,3.500000,3.351351,3.458824,3.318681,3.694175,3.241379,3.138298,3.309524,3.380000)
srednie &lt;- data.frame(strefa,a)
</code></pre>

<p>The code is:</p>

<pre><code>ggplot(srednie, aes(x=factor(strefa), y=a, label=round(a, digits = 2))) +
  geom_bar(position=position_dodge(), stat="identity",  colour="darkgrey", width = 0.5) +
  theme(legend.position="none",axis.text.x = element_blank(), axis.ticks.x = element_blank(), axis.ticks.y = element_blank()) +
  geom_text(size = 4, hjust = 1.2) +
  coord_flip(ylim = c(1,6))+
  xlab("") +
  ylab("")
</code></pre>

<p>As you can see, on bars entitled 5 and 2 the labels are limited to the 1st decimal place. How to show 2 decimal places even if there is i.e. 3.000000 or 5.999999? In such a cases I would like to show 3.00 and 6.00.</p>

<p>I tried to use as a <code>aes</code> parameter <code>label=round(a, digits = 2)</code> but it doesn't work.</p>