title: align labels to boxplot in ggplot
body: <p>I have multiple boxplots which I wish to label with the actual values above. However, I can't seem to get them to align. I end up with something like the following where the labels are not aligned. </p>
  
  <p><a href="https://i.stack.imgur.com/mug5u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mug5u.png" alt="Boxplot"></a>
  I have tried tinkering around with </p>
  
  <pre><code>geom_text(aes(label=value), position=position_dodge(width=0.9), vjust=-1) 
  </code></pre>
  
  <p>but to no avail. Any advice would be greatly appreciated. </p>
  
  <p>My script as follows: </p>
  
  <pre><code>library(reshape2)
  library(tidyverse)
  library(dplyr)
  library(ggplot2)
  library(stringr)
  
  barCount &lt;- tibble::tribble(
    ~Year, ~Lateral.bar, ~Bar.accreted.to.island, ~Mid.channel.bar,
    1990,          105,                     134,               62,
    2010,          102,                     189,              102
  )
  
  
  df2 &lt;- melt(barCount, id="Year") %&gt;% 
    mutate(
      Year = Year %&gt;% as.factor(),
      variable = variable %&gt;% str_replace_all("\\.", " ")
    )
  
  barPlot &lt;- ggplot(df2, aes(Year,value)) +
    geom_bar(aes(fill=variable),position="dodge",stat="identity") +
    labs(y="Quantity",fill="")+
    scale_fill_manual("Legend",
                      values=c("Lateral bar"="khaki4", "Bar accreted to island"="Khaki2", 
                               "Mid channel bar"="honeydew4"))+
    geom_text(aes(label=value), position=position_dodge(width=0.9),vjust=-1) 
  
  
  #modifying axis 
  barPlot &lt;- barPlot + theme(
    axis.title.x = element_blank(),
    axis.title.y = element_text(size=14),
    axis.text.x = element_text(size=14),
    legend.position="bottom" 
  
  )
  
  barPlot
  </code></pre>