R科研作图学习小组

http://group.keyangou.com/RGraph
组长: 管理员:
  • 访问次数:14216
  • 小组等级:8
  • 话题:550
  • 回答:31
  • 签到:340
  • 小组排名:
  • R2-14-第十次作业 综合任务

    lucyylx 发布于:2018.01.09

    1.

    > library(ggplot2)

    > tg<-ToothGrowth

    > library(lattice)

    > library(plyr)

    > library(Rmisc)

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

    ggplot(tgc, aes(x=dose, y=len, colour=supp, group=supp)) +geom_line(position=pd) + geom_errorbar(aes(ymin=len-se, ymax=len+se), colour="black", width=.1, position=pd)+geom_point(position=pd, size=3, shape=21, fill="white") +xlab("Dose (mg)") +ylab("Tooth length") +scale_colour_hue(name="Supplement type",breaks=c("OJ", "VC"),labels=c("Orange juice", "Ascorbic acid")) +ggtitle("R2-14") +theme_bw() +theme(panel.grid.minor = element_blank(), legend.position=c(0.86,0.1))+ theme(panel.grid.major=element_line(colour=NA))

    1.png


    2.

    > options(scipen = 999)

    > theme_set(theme_bw())

    > data("midwest",package="ggplot2")

    > ggplot(midwest,aes(x=area,y=poptotal))+geom_point(aes(col=state,size=popdensity))+ geom_smooth(method="loess",se=F,col="red")+xlim(c(0,0.1))+ylim(c(0,500000))+ scale_color_brewer(palette = "Accent")+ggtitle("R2-14")+xlab("Area")+ylab("Population")+ 

    theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank())

    2.png


    3.

    > library(pheatmap)

    > mydata=read.csv(file.choose())

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

    > row.names(mymatrix)=mydata[,1]

    > heatmap(mymatrix,Rowv=NA,Colv=NA,scale="column")

    3.png



     
    0条评论 13浏览 邀请回答
    沙发空缺中~

    小组告示

    科研狗 2012-2016 京ICP备16006621 科研好助手,专业的科研社交共享平台