R科研作图学习小组

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

    Bamboo 发布于:2018.01.09

    > getwd()

    [1] "C:/Users/Administrator/Desktop/R语言"

    > library(ggplot2)

     a<-read.csv("R2-10.csv")

    ggplot(a, aes(Time,value,color =SIZE,shape = SIZE))+geom_line(color = "black")+geom_point(size=4)+ ggtitle("R2-07")

    1.jpg

    因为之前没有找到合适的数据,只能用第一期的数据交作业了,原谅我!



    TASK  two

    > options(scipen=999)

    > library(ggplot2)

    > theme_set(theme_bw())


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

    > gg <- 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-07", caption = "Source: midwest")

    > plot(gg)



    2.jpg

    Task  three:


     library(RColorBrewer)

    > getwd()

    [1] "C:/Users/Administrator/Desktop/R语言"

    > a<-read.csv("task3.csv")

    > a <- a[order(a$PTS),]

    > row.names(a) <- a$Name

    > a <- a[,2:20]

    > a_matrix <- data.matrix(a)


     a_heatmap <- heatmap(a_matrix, Rowv=NA, Colv=NA, col = brewer.pal(9, "Blues"), scale="column", margins=c(5,10), main="R2-07")


    3.jpg

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

    小组告示

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