R2-04 第三期ggplot2 柱状图

blanking 2017-11-21 22:00:40 阅读: 970

library(ggplot2)

library(ggthemes)

R2_3_1 <- read.csv("/Users/taowang/documents/R/R2/R2-3/R2-3.1.csv",header = T)

library(reshape2)

R2_3_1 <- melt(R2_3_1, id.vars = "Products",variable.name = "Time", value.name = "Index")

png("/Users/taowang/documents/R/R2/R2-3/R2-3-1.png")

ggplot(R2_3_1, aes(Time, Index, fill = Products))+

geom_bar(stat = "identity", position = "dodge")+

ggtitle("R2_04")+

scale_fill_wsj("rgby")+

theme_economist()

dev.off()

R2-3-1.png

R2_3_2 <- read.csv("/Users/taowang/documents/R/R2/R2-3/R2_3_2.csv",header = T)

png("/Users/taowang/documents/R/R2/R2-3/R2-3-2.png")

ggplot(R2_3_2, aes(group,fill= AT))+

geom_bar(position = "stack")+

coord_flip()+

ylab("count")+

ggtitle("R2-04")

dev.off()

R2-3-2.png

 

 
邀请讨论

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
{{item.nick_name}} 受邀请回答 {{item.create_time}}
{{item.refer_comment.nick_name}} {{item.refer_comment.create_time}}

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
切换到完整回复 发送回复
赞({{item.count_zan}}) 踩({{item.count_cai}}) 删除 回复 关闭
科研狗©2015-2024 科研好助手,京ICP备20005780号-1 建议意见

服务热线

178 0020 3020

微信服务号