#creat a dataset(生成数据)
specie
condition
value
df
library(ggplot2)
#分组柱形图
p1
p1+theme(legend.position = "none")#去掉右侧图例
p1+scale_fill_manual(values=c("blue","red","green"))#自定义填充色
Rplot09.png
Rplot10.png
Rplot11.png
#堆积柱形图
ggplot(df,aes(x=specie,y=value,fill=condition))+geom_bar(stat="identity")
ggplot(df,aes(x=specie,y=value,fill=condition))+
geom_bar(stat="identity")+
geom_text(aes(label=value),position=position_stack(vjust=0.5))#添加标签
可以比较一下一下三条命令出图的区别
ggplot(df,aes(x=specie,y=value,fill=condition))+
geom_