#ve bieu do
Country= c("Vietnam", "Thailand", "Malaysia", "Indonesia", "Singapore")
Pubcations= c(17178, 42914, 71229, 19585, 69883)
dat= data.frame(Country, Pubcations)
dat
## Country Pubcations
## 1 Vietnam 17178
## 2 Thailand 42914
## 3 Malaysia 71229
## 4 Indonesia 19585
## 5 Singapore 69883
#ve bar bang ggplot2
library(ggplot2)
## Registered S3 methods overwritten by 'ggplot2':
## method from
## [.quosures rlang
## c.quosures rlang
## print.quosures rlang
p = ggplot(data=dat, aes(x=Country, y=Pubcations))
p + geom_bar(stat="identity")
p = ggplot(data=dat, aes(x=Country, y=Pubcations, fill=Country, col=Country))
p + geom_bar(stat="identity")
p = ggplot(data=dat, aes(x=reorder(Country, -Pubcations), y=Pubcations, fill=Country, col=Country))
p + geom_bar(stat="identity") + theme_bw()+theme(legend.position = "none")
p = ggplot(data=dat, aes(x=reorder(Country, Pubcations), y=Pubcations, fill=Country, col=Country))
p + geom_bar(stat="identity") + theme_bw()+theme(legend.position = "none")
#them bai
p = ggplot(data=dat, aes(x=reorder(Country, Pubcations), y=Pubcations, fill=Country, col=Country, label=Pubcations))
p=p+ geom_bar(stat="identity") + geom_text(size=3, color="white", position = position_stack(vjust=0.5))
p+ theme_bw() + theme(legend.position = "none")+ xlab("country")