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/
ggplot ggplot2 画图的更多相关文章
- ggplot2画图
早在N年前就听说这个包画图不错,一直没机会用,终于等到了.相比前面trendline这个包的可视化功能强大得多. ggplot2需要使用dataframe,其实就是一个N维数组, install.pa ...
- ggplot2画图小试
# 注意aes(x=wt, y=mpg)中的wt不是字符"wt",因此它是属性字段名(例如,EXCel中字段名有Student,那就是Student,而不是"Studen ...
- ggplot2画图时标题无法居中的问题
折腾了一天,终于好了.应该是版本的问题.在R3.2.2能居中(别问我为什么知道),在R3.3.2上就不能.解决方式如下: library(ggplot2) ggplot(data=mtcars, ae ...
- ggplot2 画图随笔
ggplot2 盒图+显著性线 compire <- list(c('1','2'),c('1','4')) ggplot(info,aes(x=cluster,y=value))+ stat_ ...
- R语言:ggplot2精细化绘图——以实用商业化图表绘图为例
本文版权归http://www.cnblogs.com/weibaar 本文旨在介绍R语言中ggplot2包的一些精细化操作,主要适用于对R画图有一定了解,需要更精细化作图的人,尤其是那些刚从exce ...
- R语言 ggplot2包
R语言 ggplot2包的学习 分析数据要做的第一件事情,就是观察它.对于每个变量,哪些值是最常见的?值域是大是小?是否有异常观测? ggplot2图形之基本语法: ggplot2的核心理念是将 ...
- ggplot绘图之基本语法
ggplot绘图之基本语法 2018年09月03日 22:29:56 一个人旅行*-* 阅读数 4332更多 分类专栏: R语言 1.ggplot2图形之基本语法: ggplot2的核心理念是将绘 ...
- ggplot map
ggplot {ggplot2} R Documentation Create a new ggplot Description ggplot() initializes a ggplot objec ...
- R----ggplot2包介绍学习
分析数据要做的第一件事情,就是观察它.对于每个变量,哪些值是最常见的?值域是大是小?是否有异常观测? ggplot2图形之基本语法: ggplot2的核心理念是将绘图与数据分离,数据相关的绘图与数据无 ...
随机推荐
- Linux学习笔记--SSH免password登录
须要实现的效果: 有两台server:"192.168.201.236" 和 "192.168.201.237" 须要实现:在server"192.1 ...
- FFmpeg(2)-avformat_open_input()函数详解并示例打开mp4文件
一. 解封装 pts 是显示的时间 dts是解码的时间, 这个时间是用来做同步. av_register_all(), 注册所有的格式.包括解封装格式和加封装格式. avformat_network_ ...
- CCParallaxNode
// 创建cat精灵 CCSprite* cat = CCSprite::create("Image\\grossini.png"); //change the transform ...
- Capterra Software Categories
https://www.capterra.com/categories this software categories is valuable.
- javascript基础拾遗(五)
1.什么是箭头函数 ES6引入的一种新的函数,类似匿名函数,x=>xx 箭头左端为函数参数,右端为函数体 相当于 function (x){ retutn xx } 2.箭头函数的特点 更简洁 ...
- 每日英语:Three Shows That Changed The Way Networks Think About Viewership
As we continue examining this season’s DVR success stories in The Blacklist and Sleepy Hollow it mak ...
- 【数据库】悲观锁与乐观锁与MySQL的MVCC实现简述
悲观锁 悲观锁,就是一种悲观心态的锁,每次访问数据时都会锁定数据: 乐观锁 乐观锁,就是一种乐观心态的锁,每次访问数据时并不锁定数据,期待数据并没作修改,如果数据没被修改则作具体的业务 应用程序上使用 ...
- RSS Reader in PC & iPhone
PC上当然是用feedly web版.但出乎意料的是,iPhone上最好用的居然是safari版QQ邮箱...
- LeetCode: Binary Tree Maximum Path Sum 解题报告
Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum. The path may start and e ...
- Python生成一个不含回文字符串的字符串
[本文出自天外归云的博客园] 回文字符串介绍 回文字符串就是对称的字符串,例如: “ABA” “ABBA” “ABCBA” 题目 给定一个字符串,请发明一种方法,让字符串中不包含回文字符串. 我的解法 ...