R2-16-第十期作业-综合案例

fjh19881216 2018-01-08 23:36:56 阅读: 999

>install.packages("gcookbook")

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

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

ggplot(fjh, 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)

> ggplot(fjh, 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)+theme_bw()+ggtitle("R2-16")

第一题2.png

> library(ggplot2)

> attach(midwest)

> class(midwest)

> midwest

>ggplot(midwest,aes(x = area, y =poptotal,colour = state))+geom_point()+geom_point(aes(col=state,size=popdensity))+geom_smooth(method="loess",se=F)+labs(subtitle="Area Vs Population",y="Population",x="Area",title="R2-16",caption="source:midwest")+xlim(c(0,0.1))+ylim(c(0,500000))

第二题.png

> 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 = "blue", high = "green")+xlab("Groups")+ ggtitle("R2-16")

第三题2.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

微信服务号