R2-27 综合作业

whk 2018-01-10 00:36:17 阅读: 1001

task1

library(ggplot2)

library(Rmisc)

mytheme=theme_classic()+theme(legend.justification=c(1,0),legend.position = c(1,0),panel.grid.major = element_blank(), panel.grid.minor = element_blank(),axis.line.x=element_line(colour = "black"),axis.line.y=element_line(colour = "black "),legend.background=element_blank())

tg=ToothGrowth

head(tg)

tgc=summarySE(tg,measurevar="len",groupvars=c("supp","dose"))

tgc

p=ggplot(tgc,aes(x=dose,y=len,color=supp,group=supp,shape=supp))+geom_line()

p

m=p+geom_errorbar(aes(ymin=len-se,ymax=len+se),width=.1)+geom_point(size=3)

m

n=m+mytheme+labs(title="R2-27")

n

 

task2

options(scipen = 999)

theme_set(theme_bw())

p2<-ggplot(midwest,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))+labs(subtitle="Area Vs Population",

 y="Population",

x="Area",

 title="R2-27",

caption="Source:midwet")

p2

 

task3

 library(pheatmap)

 library(gplots)

 library(ggplot2)

 mydata<-read.csv("D:\\task3.csv",head=TRUE)

 library(reshape2)

 mydata<-mydata[order(mydata$PTS),]

 row.names(mydata)<-mydata$Name

 mydata<-mydata[,2:20]

 mydata_matrix<-data.matrix(mydata)

 plot_mydata<-heatmap(mydata_matrix, Rowv=NA, Colv=NA, col=heat.colors(256), revC=FALSE, scale="column", margins=c(5,10))

Rplot20.pngRplot18.pngRplot19.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

微信服务号