I'm trying to create a stacked bar graph faceted into country income groups where countries are the unit for each bar. I am using the following code and it is producing an extra bar in three of the four income groups. Any ideas for how to remove the extra bars?
plot<- ggplot(data, aes(x = as.factor(country), y = rank_mean, fill = theme)) +
    geom_bar(stat = "identity") +
    geom_text(aes(label = country), y = (data$tot+20), size = 1.5, color = "black", angle = 90) +
    facet_wrap(incgrp ~ ., scales = "free_x") +
    labs(title="", x="", y="") + 
    scale_fill_manual(values = Blues) +
    theme(legend.position = 'bottom', 
      axis.text.x=element_blank(),
      axis.ticks.x=element_blank(),
      axis.text.y=element_blank(),
      axis.ticks.y=element_blank(),
      axis.title=element_text(size=10),
      legend.text=element_text(size=10),
      legend.title = element_blank()) +
    guides(fill = guide_legend(nrow = 2)) 
Here is the resulting figure: enter image description here
