1

I am building a very simple barplot with ggplot with multiple factors. One of the factor is missing (so cannot be plotted as I just don't have any data for it), no big deal but it leads to one of the bar being way bigger than the others.

Is there any way to either reduce the size of this particular bar or just avoid plotting it bigger from the start?

ggplot(data=tgc, aes(x=caste, y=dct,fill=treatment)) +  
  geom_col(width=0.7,position=position_dodge(width=0.8)) + 
  geom_errorbar(aes(ymin=dct-se, ymax=dct+se),width=.2,position=position_dodge(.8))+
  theme_bw()+
  scale_fill_manual(values=c("orangered2", "dodgerblue"))+
  theme(axis.line = element_line(colour = "black"),
      panel.grid.major = element_blank(),
      axis.title.x=element_blank(),
      axis.title.y=element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank())

Bar Q is way bigger due to the fact that there are no Q - QL data available

user3188922
  • 329
  • 1
  • 3
  • 19

1 Answers1

0

Transform it before you plot it. If you apply a log on the measurement variable, the differences among the plots will be reduced.

Jorge Lopez
  • 467
  • 4
  • 10