R科研作图学习小组

http://group.keyangou.com/RGraph
组长: 管理员:
  • 访问次数:22643
  • 小组等级:9
  • 话题:593
  • 回答:39
  • 签到:408
  • 小组排名:
  • R2-27 综合作业

    whk 发布于:2018.01.10

    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

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

    小组告示

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