R2-28第十次作业 综合案例

探花1号 2018-01-04 12:44:30 阅读: 1175

> library(gcookbook)

> library(ggplot2)

> supp1=c("OJ","OJ","OJ","VC","VC","VC")

> dose1=c(0.5,1.0,2.0,0.5,1.0,2.0)

> length1=c(13.23,22.70,26.06,7.98,16.77,26.14)

> tgg=data.frame(supp1,dose1,length1)

ggplot(tgg, aes(x=dose1, y=length1, color=supp1,shape=supp1)) +geom_line(position=position_dodge(0.2)) +geom_point(position=position_dodge(0.2),size=4)

> p<-ggplot(tgg, aes(x=dose1, y=length1, color=supp1,shape=supp1)) +geom_line(position=position_dodge(0.2)) +geom_point(position=position_dodge(0.2),size=4)

> p+ggtitle('R2-28') +theme_bw()




> library(ggplot2)

> attach(midwest)

> class(midwest)

> Midwest

>ggplot(midwest,aes(x = area, y =poptotal,colour = state))+geom_point()

> p<-ggplot(midwest,aes(x = area, y =poptotal,colour = state))+geom_point()

>  p+geom_point(aes(col=state,size=popdensity))

> h<- p+geom_point(aes(col=state,size=popdensity))

> h+geom_smooth(method=”loess”,se=F)

>  h+geom_smooth(method="loess",se=F)

> w<-h+geom_smooth(method="loess",se=F)

w+labs(subtitle="Area Vs Population",y="Population",x="Area",title="R2-28",caption="source:midwest")

> q<-w+labs(subtitle="Area Vs Population",y="Population",x="Area",title="R2-28",caption="source:midwest")

> q+xlim(c(0,0.1))+ylim(c(0,500000))




> library(ggplot2)

> library(reshape2)

>  library(plyr)

> library(scales)

> data<- read.csv(file.choose())

> data

> mydata<- melt(data,id.vars=c("Name"))

>  mydata2<-ddply(mydata,.(variable), transform,label=rescale(value))

>  ggplot(mydata2, aes(x=variable,y=Name))+geom_tile(aes(fill=label))+scale_fill_gradient(low = "yellow", high = "red")+xlab("Groups")

> p<- ggplot(mydata2, aes(x=variable,y=Name))+geom_tile(aes(fill=label))+scale_fill_gradient(low = "yellow", high = "red")+xlab("Groups")

> p+ ggtitle("R2-28")


 


 
邀请讨论

附件

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

微信服务号