服务热线
178 0020 3020
任务一:
install.packages("ggthemes")
library(ggplot2)
library(reshape2)
library(ggthemes)
data1=read.csv(file.choose())
data1=melt(data1,id.vars="Products",variable.name="Time",value.name="Index")
data1
p=ggplot(data1,aes(x=Time,y=Index,fill=Products))+geom_bar(stat="identity",position = "dodge")+labs(title="R2-22")+scale_fill_wsj("rgby")+theme_economist()
p
任务二:
library(ggplot2)
data2=read.csv(file.choose())
data2
q=ggplot(data2,aes(社区,fill=态度))+geom_bar(position="stack")
q+coord_flip()+labs(title="R2-22")
附件