scale_y_continuous( expand = expansion(mult = c(0, .1))) # 添加此代码即可
未添加之前对比:
p1 <- ggplot(psum,aes( x=Count) ) +
geom_bar(aes(fill = Class),width = 0.6) +
ylab("Number of Gene family") +
xlab("Frequency") +
scale_x_continuous(breaks=1:sampleN)+
scale_fill_manual(values = family_color, # 设置颜色
name = NULL, # 不显示图例标题
) +
scale_y_continuous( expand = expansion(mult = c(0, .1))) + # 设置y#################
theme_bw() +
theme(legend.title=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
#legend.position = c(0.9, 0.6),
#legend.position = c(.95, .95),
#legend.justification = c("right", "top"),
axis.text.x=element_text(colour="black"),
#axis.text.y=element_text(colour="black"),
legend.box.just = "right",panel.grid=element_blank())
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!