I want to generate several plots for diferent categories, so I have the following code:
for (módulo in pruebas) {
  plot <- ggplot(data = pruebas.oficiales[pruebas.oficiales$prueba==módulo,],
                 aes(y = Promedio.prueba, x = año)) +
    geom_point(shape = 18, size = 4, 
               color = "#A32F4A") +
    geom_errorbar(data = pruebas.oficiales[pruebas.oficiales$prueba==módulo,],
                  aes(ymin = Promedio.prueba - Desviacion,
                      ymax = Promedio.prueba + Desviacion),
                  color = "#A32F4A", width = 0.4, size = 1.3) +
    theme(
      panel.background = element_rect(fill = "white", 
                                      color = rgb(198, 198, 198, 
                                                  maxColorValue = 255),
                                      size = 1, linetype = "solid"),
      panel.grid.minor = element_line(size = 0.1, linetype = "dashed",
                                      color = rgb(198,198,198, maxColorValue = 255)),
      axis.title = element_text(color = "#575756", family = "Montserrat"),
      axis.text = element_text(family = "Montserrat")
    ) + geom_text(aes(label = Promedio.prueba), hjust = "left",
                  nudge_x = 0.145, show.legend = F, color = "#575756",
                  size = 4, family = "Montserrat") +
    geom_text(aes(label = paste("(", Desviacion, ")")),
              show.legend = F, color = "#575756", hjust = "left",
              vjust = 2, nudge_x = 0.1, size = 4, family = "Montserrat") +
    xlab(NULL) + ylab("Promedio de la prueba")
  assign(paste0("plot.", módulo), plot)
}
If the corresponding "prueba" has four categories for the variable "año" I get a plot like

If the corresponding "prueba" has two categories for the variable "año" I get a plot like

For the latter, the upper labels are not align with the lower labels. Does anyone know how I can make all the plots have aligned labels regardless on the number of categories for "año" they have?
 
    