1 双向条图
Code
ggplot(df,
aes(x=factor(id,levels = unique(id)),
y=if_else(group=="Up",y,-y),
fill=group))+
geom_bar(stat = "identity")+
coord_flip()+
geom_text(aes(label=y,hjust=if_else(group=="Up",-0.5,1),
#vjust=if_else(group=="Up",-0.5,0.5)
)
)+
scale_x_discrete(name = "")+
scale_y_continuous(name = "expenssion",expand = expansion(mult = c(0.1,0.1)))