服务热线
178 0020 3020
>library("ggplot2")
>library("reshape2")
>library("ggthemes")
>data2<-
+read.csv(file.choose("F:R语言学习/R2-3.1.csv"))
>data2<-melt(data2,id.vars='Products',measure.vars=c("Q1th","Q2nd","Q3rd","Q4th"))
>ggplot(data2,aes(x=variaable,y=value,fill=Products))+geom_bar(stat="identity",position="dodge",color="black")+labs(x="Time",y="Index")+ggtitle("R2-16")+scale_fill_wsj("rgby")+theme_wsj(base_size=6,color="blue")
>library("ggplot2")
>data3<-
+read.csv(file.choose("F:R语言学习/R2_3_2.csv"))
>ggplot(data3,aes(x=社区,fill=态度))+geom_bar(position="stack")+labs(x="count",y="社区")+coord_flip()+scale_fill_brewer(palette="Pastel1")+ggtitle("R2-16")
附件