折线图-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/

ggplot ggplot2 画图的更多相关文章

  1. ggplot2画图

    早在N年前就听说这个包画图不错,一直没机会用,终于等到了.相比前面trendline这个包的可视化功能强大得多. ggplot2需要使用dataframe,其实就是一个N维数组, install.pa ...

  2. ggplot2画图小试

    # 注意aes(x=wt, y=mpg)中的wt不是字符"wt",因此它是属性字段名(例如,EXCel中字段名有Student,那就是Student,而不是"Studen ...

  3. ggplot2画图时标题无法居中的问题

    折腾了一天,终于好了.应该是版本的问题.在R3.2.2能居中(别问我为什么知道),在R3.3.2上就不能.解决方式如下: library(ggplot2) ggplot(data=mtcars, ae ...

  4. ggplot2 画图随笔

    ggplot2 盒图+显著性线 compire <- list(c('1','2'),c('1','4')) ggplot(info,aes(x=cluster,y=value))+ stat_ ...

  5. R语言:ggplot2精细化绘图——以实用商业化图表绘图为例

    本文版权归http://www.cnblogs.com/weibaar 本文旨在介绍R语言中ggplot2包的一些精细化操作,主要适用于对R画图有一定了解,需要更精细化作图的人,尤其是那些刚从exce ...

  6. R语言 ggplot2包

    R语言  ggplot2包的学习   分析数据要做的第一件事情,就是观察它.对于每个变量,哪些值是最常见的?值域是大是小?是否有异常观测? ggplot2图形之基本语法: ggplot2的核心理念是将 ...

  7. ggplot绘图之基本语法

    ggplot绘图之基本语法 2018年09月03日 22:29:56 一个人旅行*-* 阅读数 4332更多 分类专栏: R语言   1.ggplot2图形之基本语法: ggplot2的核心理念是将绘 ...

  8. ggplot map

    ggplot {ggplot2} R Documentation Create a new ggplot Description ggplot() initializes a ggplot objec ...

  9. R----ggplot2包介绍学习

    分析数据要做的第一件事情,就是观察它.对于每个变量,哪些值是最常见的?值域是大是小?是否有异常观测? ggplot2图形之基本语法: ggplot2的核心理念是将绘图与数据分离,数据相关的绘图与数据无 ...

随机推荐

  1. php分享十七:http状态码

    一:http状态码 (200,301,302,304,305,400,401,403,404,500,501,502,503,504) HTTP状态码(HTTP Status Code)是用以表示网页 ...

  2. OVAL学习笔记

                很多其它好文章:http://blog.csdn.net/aap159951/article/details/51131937        OVAL由MITRE公司开发.是一 ...

  3. jenkins + gerrit 自动code review

    最近有需求要push review以后自动跑一些测试,如果通过就自动+2 不通过就-2,目前做法如下(jenkins gerrit均已配置好,Jenkins可以连接gerrit并拉代码): 1. Je ...

  4. 在/etc/my.cnf未配置 [clIent] 导到mysql找不到socket

    [root@DB mysql-5.6.16]# ./bin/mysql ERROR 2002 (HY000): Can't connect to local MySQL server through ...

  5. C语言发展历程及其保留字(关键字)——附:C语言标准文档

    引言         抽时间对C语言发展历程和C语言的标准库文件及其保留字/关键字做了个梳理,后面附C语言各版本国际标准. C语言发展历程及其标准库 C语言关键字/保留字 C语言国际标准       ...

  6. localtime 和 localtime_r

    #include <cstdlib> #include <iostream> #include <time.h> #include <stdio.h> ...

  7. ny24 素数距离的问题 筛选法求素数

    素数距离问题时间限制:3000 ms  |  内存限制:65535 KB难度:2 描述    现在给出你一些数,要求你写出一个程序,输出这些整数相邻最近的素数,并输出其相距长度.如果左右有等距离长度素 ...

  8. LeetCode: Balanced Binary Tree 解题报告

    Balanced Binary Tree Given a binary tree, determine if it is height-balanced. For this problem, a he ...

  9. 【机器学习】主成分分析PCA(Principal components analysis)

    1. 问题 真实的训练数据总是存在各种各样的问题: 1. 比如拿到一个汽车的样本,里面既有以“千米/每小时”度量的最大速度特征,也有“英里/小时”的最大速度特征,显然这两个特征有一个多余. 2. 拿到 ...

  10. LVS负载均衡模型及算法概述

    集群类型 LB: Load Balancing,负载均衡 HA:High Availability, 高可用 HP:High Performance, 高性能   负载均衡 负载均衡设备 Hardwa ...