赞
踩
用ggplot2包绘制柱形图
- #加载R包
- library(ggplot2)
- #读取电脑上csv文件
- data<-read.csv(file=file.choose(),header=T,sep=",")
-
- chao<- ggplot(data,aes(x,chao,fill=group1))
- +scale_color_manual(values=rep(c("red","blue"),time=6))
- +geom_bar(stat="identity",position="stack",width=0.75)
- +theme(axis.title=element_blank(),axis.text.x=element_text(colour="black",size=10,face="bold"))
- +theme_classic()
- +theme(axis.ticks.length.x=unit(0,'cm'),panel.background=element_blank(),panel.grid.minor=element_blank(),panel.grid.major=element_blank(),legend.title=element_blank(),legend.text=element_text(face="bold",color = "black",size=13))
- +labs(x="",y="",title = "Chao1")
- +scale_y_continuous(expand = c(0,0))
- +theme(axis.line = element_line(arrow =arrow(length = unit(0.15,'cm')) ))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。