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的核心理念是将绘图与数据分离,数据相关的绘图与数据无 ...
随机推荐
- Atitit 爬虫 node版 attilaxA
Atitit 爬虫 node版 attilax 1.1. 貌似不跟python压实,,java的webmagic压实,,什么爬虫框架也没有,只好自己写了. 查了百度三爷资料也没有.都是自己写.. 1. ...
- [svc]NFS存储企业场景及nfs最佳实战探究
办公网络里人一般系统用共享,尤其是财务, 他们喜欢直接点开编辑. 而不喜欢ftp nfs在网站架构中的用途 注: 如果pv量少,则放在一台机器上速度更快,如果几千万pv,则存储分布式部署. 网站架构中 ...
- Codeforces Round #Pi (Div. 2)(A,B,C,D)
A题: 题目地址:Lineland Mail #include <stdio.h> #include <math.h> #include <string.h> #i ...
- async与await 实例
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Socket网络编程--Libev库学习(2)
这一小节讲各个观察器(Watcher) 在libev下面watcher相当于EventHandler这么一个概念,通常里面会绑定fd回调函数以及我们需要关注的事件. 然后一旦触发事件之后会触发我们使用 ...
- mongodb更新数组中的所有匹配项
假如集合中有如下数据 { "_id" : ObjectId("4b97e62bf1d8c7152c9ccb74"), "title" : & ...
- debian8.5安装sublime text3
在官网www.sublimetext.com下载安装包 我这里用的是Ubuntu 64 bit版. 下载后使用su命令切换到root账户. 执行安装命令 dpkg -i sublime-text*.d ...
- Vue.js使用-组件(下篇)
上一节,我们定义了组件的基本使用,下面我们看看组件其他的一些特性. 1.组件作用域 同时在Vue对象和组件中定义一个属性,显示结果是怎样的呢? <!DOCTYPE html> <ht ...
- 【Gtk】feorda下gtk安装详解
feorda下gtk安装详解 1.yum在线安装gtk 1)pkg-config -version查看pkg-config的版本(本机测试是0.25) 2)安装必要组建:(在root权限下) ...
- hive外部表删除遇到的一个坑
hive外部表删除遇到的一个坑 操作步骤 创建某个表(create external table xxx location xxx) 插入数据(insert xxx select xxx from x ...