Skip to content

Commit

Permalink
Update 图3-2-1_条形图系列.R
Browse files Browse the repository at this point in the history
  • Loading branch information
EasyChart authored Jun 3, 2019
1 parent 8813bfb commit 40c524e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions 第3章_类别比较型图表/图3-2-1_条形图系列.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

#EasyCharts团队出品,如有商用必究,
#如需使用与深入学习,请联系微信:EasyCharts
#EasyCharts团队出品,
#如有问题修正与深入学习,可联系微信:EasyCharts

library(ggplot2)
library(RColorBrewer)

#---------------------------单数剧系列条形图----------------------------------------------------
#---------------------------单数剧系列条形图----------------------------------------------------
mydata<-read.csv("Stackedbar_Data.csv",sep=",",na.strings="NA",stringsAsFactors=FALSE)

mydata$Country <- factor(mydata$Country, levels = mydata$Country[order(mydata$Pensions)])
Expand All @@ -22,7 +22,7 @@ ggplot(data=mydata,aes(Country,Pensions))+
legend.position = "right"# c(0.83,0.15)
)

#---------------------------双数剧系列条形图----------------------------------------------------
#---------------------------双数剧系列条形图----------------------------------------------------
library(reshape)
mydata<-read.csv("Stackedbar_Data.csv",sep=",",na.strings="NA",stringsAsFactors=FALSE)

Expand All @@ -44,7 +44,7 @@ ggplot(data=mydata,aes(Country,value,fill=variable))+
)


#-------------------------------堆积条形图-------------------------------------------------------
#-------------------------------堆积条形图-------------------------------------------------------
mydata<-read.csv("Stackedbar_Data.csv",sep=",",na.strings="NA",stringsAsFactors=FALSE)


Expand All @@ -66,7 +66,7 @@ ggplot(data=mydata,aes(Country,value,fill=variable))+
legend.position = "right"# c(0.83,0.15)
)

#------------------------------百分比堆积柱形图-------------------------------------------------------
#------------------------------百分比堆积柱形图-------------------------------------------------------
mydata<-read.csv("Stackedbar_Data.csv",sep=",",na.strings="NA",stringsAsFactors=FALSE)

sum<-sort(rowSums(mydata[,2:ncol(mydata)]),index.return=TRUE)
Expand Down

0 comments on commit 40c524e

Please sign in to comment.