服务热线
178 0020 3020
任务1:
> library(ggplot2)
> p=ggplot()
> library(reshape2)
> library(ggthemes)
> r=read.csv("/Users/liutianzi/Downloads/R2-3.1.csv",head=T)
> head(r)
> r1=melt(r,id.vars="Products",variable.name = "Time",value.name="Index")
> p +scale_fill_wsj("rgby")+geom_bar(data=r1,aes(x=Time,y=Index,fill=Products),stat="identity",position="dodge")+theme_economist()+ggtitle("R2-21")
任务2:
> r=read.table("/Users/liutianzi/Downloads/R2_3_2_mac.csv",head=T,sep=",")
> head(r)
> p+geom_bar(data=r,aes(x=社区,fill=态度))+coord_flip()+theme(text=element_text(family="STKaiti",size=12))+ggtitle("R2-21")
附件