0

I want to plot a dodge grouped bar charts with a p value in ggplot. Without p value the number of each bar is shown correctly, but after adding stat_pvalue_manual only the total of each category be appeared.

ggplot(MPP,mapping=aes(x=TBI))+
  geom_bar(mapping=aes(fill=mp_1),position="dodge", width=0.5)+
  geom_text(aes(label=..count..), stat="count",vjust=1.5, colour="white", size=3.5, position = position_dodge(.5))+
  stat_pvalue_manual(
    stat.test, 
    y.position = 150, step.increase = 0.1,
    label = "p.adj"
    )+
  scale_fill_manual("mp_1",values = c('#0023a0', '#f9a635'))+
  scale_x_discrete(name="Brain Injury", labels=c("Yes","No"))+
  scale_y_continuous(name="Frequency")

Roxana
  • 1
  • 2
  • 4
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Aug 13 '21 at 21:16

0 Answers0