x-axis labels in one of the plots incuded in a plot arrange missing ussing ggarrange

31 Views Asked by At

I am preparing some plots and intend to put them together using ggarange. The x and y axes are correct when I put them all together, for some reason one of the labels of the x-axis does not appear

see the bottom right plot

Here is the toy data that I used to make the plot attached.

d <- data.frame(cort=c(1,5,7,3),sd_cort=c(0.2,0.2,0.7,0.3),t=c(3,2,6,2),
              sd_testo=c(0.2,0.2,0.7,0.3),ldl=c(1,5,7,3),
              sd_ldl=c(0.2,0.2,0.7,0.3),r=c(3,2,6,2),
              sd_r=c(0.2,0.2,0.7,0.3),stages=c("juv","ad1","ad2","senec"))

library(ggplot2)

p_cort<-ggplot(data = d,aes(x=stages,y=cort))+
  geom_bar(position=position_dodge(0.5),color="black",
           stat="identity",width = 0.5)+ theme_classic()

p_t<-ggplot(data = d,aes(x=stages,y=t))+
  geom_bar(position=position_dodge(0.5),color="black",
           stat="identity",width = 0.5)+ theme_classic()

p_ldl<-ggplot(data = d,aes(x=stages,y=ldl))+
  geom_bar(position=position_dodge(0.5),color="black",
           stat="identity",width = 0.5)+ theme_classic()

p_r<-ggplot(data = d,aes(x=stages,y=r))+
  geom_bar(position=position_dodge(0.5),color="black",
           stat="identity",width = 0.5)+ theme_classic()

library(ggpubr)

all<-ggarrange(p_cort, p_t, p_ldl,p_r+ rremove("x.text"), 
                ncol = 2, nrow = 2,common.legend = TRUE, legend="top")  

all
0

There are 0 best solutions below