服务热线
178 0020 3020
任务1:
>dat = read.csv(file.choose(),header = T)
> library(reshape2)
> library(ggplot2)
> library(ggthemes)
> dat2 <- melt(dat, id.vars = 'Products', measure.vars = c("Q1th", 'Q2nd', 'Q3rd','Q4th'), variable.name = 'Time', value.name = 'Index')
>ggplot(dat2, aes(x=Time, y= Index, fill = Products))+geom_bar(stat="identity", position="dodge",alpha = 0.8) +labs(x="Time", y="Index")+ ggtitle("R2-29 CC")+scale_fill_wsj("rgby")+theme_economist()
任务2:
> dat3<-read.csv(file.choose(),header = T)
> ggplot(dat3, aes(x=社区, fill = 态度))+geom_bar(position="stack",alpha = 0.8) +labs(x="Count",y="社区")+ ggtitle("R2-29 CC")+scale_fill_brewer(palette="Pastel1")+coord_flip()
附件