Country=c("Vietnam", "Thailan", "Malaysia", "Indonesia", "singapore")
Pubcations=c(17178, 42914, 71229, 19585, 69883)
dat=data.frame(Country, Pubcations)
dat
## Country Pubcations
## 1 Vietnam 17178
## 2 Thailan 42914
## 3 Malaysia 71229
## 4 Indonesia 19585
## 5 singapore 69883
#analysis, vẽ biểu đồ bar
library(ggplot2)
p=ggplot(data=dat, aes(x=Country, y=Pubcations, fill=Country, col=Country))
p= p+geom_bar(stat="identity") + theme_bw()+ theme(legend.position = "none")
p
# xép theo thứ tự từ thấp đến cao và đưa số liệu vào bar
p=ggplot(data=dat, aes(x=reorder(Country, Pubcations), y=Pubcations, fill=Country, col=Country, label=Pubcations))
p= p+geom_bar(stat="identity") + theme_bw()+ theme(legend.position = "none")
p= p+geom_bar(stat="identity") + theme_bw()+ theme(legend.position = "none")+xlab("Counry")
p
#cho số liệu vào bar bằng geom_text
p= p+geom_bar(stat="identity") + geom_text(size=3,color="white", position=position_stack(vjust=0.5))
p