服务热线
178 0020 3020
任务一
library(ggplot2)
library(reshape2)
library(ggthemes)
read.csv(file="F:\\R学习作业\\20171120\\R2-3.1.csv")
mydata<-read.csv(file="F:\\R学习作业\\20171120\\R2-3.1.csv")
mydata<-melt(mydata,id.vars="Products",measure.vars=c("Q1th","Q2nd","Q3rd","Q4th"))
ggplot(mydata,aes(x=variable,y=value,fill=Products))+
geom_bar(stat="identity", position="dodge", color= "black") +
labs(x="Time", y="Index")+ ggtitle("R2-17")+scale_fill_wsj("rgby")+theme_wsj(color="blue")
任务二
library(ggplot2)
mydata<-read.csv(file="F:\\R学习作业\\20171120\\R2_3_2.csv")
ggplot(mydata,aes(x=社区,fill=态度))+
geom_bar(position="stack")+
labs(x="社区",y="count")+coord_flip()+
scale_fill_brewer(palette="Pastel1")+
ggtitle("R2-17")
附件