R语言标签分面绘图没有居中

img

img


请问大家我的这个分面标签为什么不能居中呢?
代码如下:

ggplot(ALL, aes(rowname,value))+
  geom_point(size = 5,color="red")+
  theme_set(theme_bw())+
  theme(axis.text = element_text(size=26))+
  theme(text=element_text(hjust=1,size=26))+
  theme(plot.title = element_text(size = 26,hjust=0.5))+
  theme(axis.title =element_text(size = 26,hjust=0.5) )+
  scale_x_continuous(limits = c(-2.5, 110))+
  theme(panel.border = element_rect(fill=NA,color="black", size=1, linetype="solid"))+
  theme(axis.line = element_line(size = 1, colour = "black", linetype = 1)) +
  geom_smooth(method = "lm",color="blue",formula = y~x,size=2,linetype = 1,alpha = 0.5)+
  labs(x="time",y="dissmility",colour = "Cylinders",title = "winter.YX",tag = waiver())+
  facet_grid(site~season,scales = 'free_x')+scale_x_continuous(expand = c(0, 3))####删除标签分面缓冲区

可以尝试添加:theme(facet.margin = margin(2,2,2,2, "cm")),这样就可以设置分面标签的边距,使其居中。

把第五行的hjust=1改成0.5