R2-22综合案例

LIUUU 2018-01-08 14:50:25 阅读: 1015

任务一:

Install.packages(“Rmisc”)

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 = "grey"),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-22")

n

Rplot03.png


任务2:

library(ggplot2)

options=(scipen=999)

mytheme=theme_bw()

data(midwest)

data

a=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))

a

p=a+labs(substitle="Area Vs Population",y="Population",x="Area",title="R2-22",caption="Source:midwest")+mytheme

p

2.png


任务三:

library(ggplot2)

data=read.csv(file.choose(),header = TRUE)

data

data=data[order(data$PTS),]

row.names(data)=data$Name

data=data[,-c(2:50)]

data1=data.matrix(data)

data1

P=heatmap(data1,Rowv=NA,Colv=NA,scale="column")

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

微信服务号