title: Center alignment of text over each bar on faceted, dodged bar plot using ggplot2 in R
body: <p>I would like my text to be center-aligned above each bar in a faceted dodged bar plot. </p>
  
  <pre><code># setup
  library(ggplot2); library(tidyverse)
  data("iris")
  
  # graph
  iris %&gt;% group_by(Species) %&gt;% 
  mutate(Petal_Group = ifelse(Petal.Width &lt; median(Petal.Width), "Short", "Long")) %&gt;% 
  mutate(Sepal_Group = ifelse(Sepal.Width &lt; median(Sepal.Width), "Short", "Long")) %&gt;% 
  group_by(Petal_Group, Sepal_Group, Species) %&gt;% 
  summarise(mean.Sepal.Length = mean(Sepal.Length)) %&gt;% 
  mutate(asterisks = "***") %&gt;% 
  ggplot(aes(x = Petal_Group, y = mean.Sepal.Length)) + 
      geom_col(aes(fill = Species), position = "dodge") + 
      geom_text(aes(label=asterisks, group = Species), position = position_dodge(width = 1)) + 
      facet_grid(~Sepal_Group, labeller = label_parsed) + 
      theme(legend.position = "bottom", panel.background = element_blank(), panel.border = element_rect(colour = "black", fill = NA, size = 0.2), strip.background = element_blank())
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/eGAQY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eGAQY.png" alt="Example of a faceted dodged bar plot that needs text center-alignment"></a></p>
  
  <p>In the example (sorry if it's overcomplicated but I'm working with something like this), the triple asterisks ("***") are not centered over each bar. I.e., the asterisks over red bars appear on the left and the asterisks over the blue bars appear on the right.</p>
  
  <p>I tried adjusting the hjust in <code>geom_text</code> but I couldn't get it right. (And isn't there a more universal way of center alignment, something like <code>position = "center"</code>?)</p>