• ggplot ggplot2 画图


    折线图-ggplot2 
    http://blog.163.com/yugao1986@126/blog/static/6922850820131161531421/
    http://blog.sina.com.cn/s/blog_7cffd1400101f50v.html

    《R Graphics Cookbook-By Winston Chang》

    #======================
    折线图
    library(ggplot2)  #作图
    library(gcookbook)  #案例数据
    library(plyr)  #ddply()、desc()等函数
    # In addition to the variables mapped to the x- and y-axes, map another
    # (discrete) variable to colour or linetype Load plyr so we can use ddply()
    # to create the example data set Summarize the ToothGrowth data
    tg <- ddply(ToothGrowth, c("supp", "dose"), summarise, length = mean(len))
    # Map supp to colour
    ggplot(tg, aes(x = dose, y = length, colour = supp)) + geom_line()

    ==============

    # save as :
    # figure_TSS_5k_methy_level_Male_Adipose.R.pdf


    library(ggplot2)  #作图
    setwd("E:\_data\")
    group<-rep("xxxx",200)
    window_index<-rep(1,200)
    methy<-rep(0.0001,200)

    inputfile_name=paste0("level.average")  
    mydata <- read.table(inputfile_name, header=FALSE)
    for(ii in 1:100)
    {
      group[ii]<-"MAL"
      window_index[ii]<-ii
      methy[ii]<-mydata[1,ii]
    }


    inputfile_name=paste0(".level.average")  
    mydata <- read.table(inputfile_name, header=FALSE)
    for(ii in 1:100)
    {
      group[ii+100]<-"MAC"
      window_index[ii+100]<-ii
      methy[ii+100]<-mydata[1,ii]
    }
       
    mydata<-data.frame(group=group,window_index=window_index,methy=methy)

    ggplot(mydata, aes(x = window_index, y =methy , colour = group)) + geom_line()

    ==============
    dev.new(width=5, height=4)  #窗口大小尺寸

    ==============

     http://docs.ggplot2.org/current/

  • 相关阅读:
    SolidWorks 2-12 拉伸特征03
    css记
    微信小程序的wxss好难啊,记录我的搞笑界面
    redis的学习使用,第二章
    本周学习Task-Rocketmq
    springcloud-ribbon的使用
    eclipse上使用svn更新代码
    新入职感觉
    在windows里面的数据库里面存emoji表情
    centos7,关闭mysql。出现mysql启动不了的情况
  • 原文地址:https://www.cnblogs.com/emanlee/p/4003827.html
Copyright © 2020-2023  润新知