R2-33 综合任务

R48-小之 2018-01-09 20:03:27 阅读: 997

Task1

library(ggplot2)

data<- ToothGrowth

write.table (data, file ="data.csv", sep =",", row.names =FALSE, col.names =TRUE, quote =TRUE)

data1<-read.csv("R2-10.csv")

p<-ggplot(data1,aes(data1,x=dose,y=len,color=supp))+geom_line(size=1.5,position=pd)+geom_point(size=3,position=pd)+

geom_errorbar(aes(ymin=len-sd,ymax=len+sd,color=supp),size=1.2,position=pd)+ggtitle("R2-33")+xlab("Dose(mg)")+ylab("Tooth length")+

scale_color_hue(name="Supplement type",breaks=c("OJ","VC"),labels=c("Orange juice","Ascorbic acid"))+

theme_bw()+theme(legend.justification=c(1,0),legend.position=c(1,0))

P

 1.png

Task2

library(ggplot2)

data2<-midwest

head(data2)

p<- ggplot(data2,aes(x=area,y=poptotal))+geom_point(aes(col=state,size=popdensity))+

geom_smooth(method="loess",se=F)+xlim(c(0,0.1))+ylim(c(0,500000))+xlab("Area")+ylab("Population")+labs(subtitle="Area vs Population",title="R2-33",caption="Source:midwest")

p+theme_bw()


2.png

Task3

install.packages("RColorBrewer")

library(RColorBrewer)

library(ggplot2)

data3<- read.csv("Task3.csv")

mymatrix=data.matrix(data3[,c(-1)])

row.names(mymatrix)=data3[,1]

heatmap(mymatrix,Rowv=NA,Colv=NA,col=brewer.pal(9,"Blues"),scale="column",main="R2-33")

 

 3.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

微信服务号