第二期 作业提交 R37-木子

木爻子木 2017-10-19 13:52:17 阅读: 1022

将工作目录改到D:/R语言学习资料/R group task 3

3.1

getwd()

data = read.table("Revenue chart.txt",header=T)

x <- data$Month

y <- data$Revenue

png("Revenue Chart.png",width=480,height=480)

barplot(y,xlab="Month",ylab="Revenue",main="Revenue Chart",col="blue",names.arg=x)

dev.off()



3.2

M <- c("Jan", "Feb", "Mar", "Apr", "May", "Jun")

part1 <- c(2,4,1,6,5,2)

part2 <- c(2,5,2,7,6,2)

part3 <- c(3,3,1,7,5,6)

png("Revenue Chart-2.png")

barplot(rbind(part1,part2,part3),

        names.arg = M, 

        xlab = "Month",

        ylab = "Revenue",

        main = "Revenue chart",

        col = c("yellow","green", "red")

)

legend("topleft",c("part1","part2","part3"),fill = c("yellow","green", "red"))

dev.off()


 
邀请讨论

附件

{{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

微信服务号