我做的分组箱式图,组内图形重叠到一起了,该如何使它们不要重叠起来?

theme_zg <- function(..., bg='white'){
require(grid)
theme_classic(...) +
theme(rect=element_rect(fill=bg),
plot.margin=unit(rep(0.5,4), 'lines'),
panel.background=element_rect(fill='transparent',color='black'),
panel.border=element_rect(fill='transparent', color='transparent'),
panel.grid=element_blank(),#去网格线
axis.line = element_line(colour = "black"),
axis.title.x = element_text(face = "bold",size = 14),#去x轴标签
axis.title.y=element_text(face = "bold",size = 14),#y轴标签加粗及字体大小
axis.text = element_text(face = "bold",size = 12),#坐标轴刻度标签加粗
axis.ticks = element_line(color='black'),
# axis.ticks.margin = unit(0.8,"lines"),
legend.title=element_blank(),
legend.position=c(0.5, 0.93),#图例在绘图区域的位置
legend.direction = "horizontal",
legend.text = element_text(face = "bold",size = 8,margin = margin(r=8)),
legend.background = element_rect( linetype="solid",colour ="black")
)
}
p2 <- ggplot(dat6, aes(x = factor(郁闭度, levels=c("0~0.3","0.3~0.5","0.5~0.7", "0.7~1.0")), y = value))+
geom_boxplot(aes(fill = factor(type, levels=c("S","Shannon","Simpson", "Pielou"))),position=position_dodge(0.5),width=0.6)+
scale_fill_manual(values = c("red", "green","blue","yellow"))+theme_zg()+
xlab("郁闭度")+
scale_y_continuous(expand = c(0,0),limits = c(0,2.5),breaks = c(0,0.5,1.0,1.5,2.0,2.5))
p2