几个有趣的R代码
此图代表我的心
n=50000;
r=0.7;r_e=(1-r*r)^.5;
X=rnorm(n);
Y=X*r+r_e*rnorm(n);
Y=ifelse(X>0,Y,-Y);
plot(X,Y,col="pink")
我心因你而有爱
n=50000;
r=0.7;r_e=(1-r*r)^.5;
X=rnorm(n);
Y=X*r+r_e*rnorm(n);
Y=ifelse(X>0,Y,-Y);
a<-sample(c(2,6,7,8),50000,T)
b<-sample(c(76,79,86,69),50000,T)
plot(X,Y,col=0)
text(X,Y,"lOVE",col=a)
此图太猥琐了,运行结果就不贴上了
xrange = c(-15, 15)
yrange = c(0, 16)
plot(0, xlim = xrange, ylim = yrange, type = "n")
#plot(xrange, yrange, type="n", ann=FALSE, axes=FALSE)
yr = seq(yrange[1], yrange[2], len = 50)
offsetFn = function(y) {
2 * sin(0 + y/3)
}
offset = offsetFn(yr)
leftE = function(y) {
-10 - offsetFn(y)
}
rightE = function(y) {
10 + offsetFn(y)
}
xp = c(leftE(yr), rev(rightE(yr)))
yp = c(yr, rev(yr))
polygon(xp, yp, col = "#ffeecc", border = NA)
h = 9
xt = seq(0, rightE(h), len = 100)
yt = log(1 + log(1 + log(xt + 1)))
yt = yt - min(yt)
yt = h * yt/max(yt)
x = c(leftE(h), rightE(h), rev(xt), -xt)
y = c(h, h, rev(yt), yt)
polygon(x, y, col = "red", border = NA)
来源:http://yixf.name/2011/04/02/%E6%B5%AA%E6%BC%AB%E7%9A%84%E8%A1%A8%E7%99%BD%E4%B8%8E%E7%8C%A5%E7%90%90%E7%9A%84%E7%9B%B8%E6%80%9D-%E5%87%A0%E4%B8%AA%E6%9C%89%E8%B6%A3%E7%9A%84r%E4%BB%A3%E7%A0%81/
相关推荐:
- NCBI在线BLAST使用方法与结果详解 2938
- 神经网络术语:Epoch、Batch Size和迭代 527
- Consed的安装与使用教程 465
- 陈连福的NGS生物信息学培训教材V2.1 277
- WGCNA分析使用教程 272
最新创建圈子
-
原料药研发及国内外注册申报
2019-01-25 10:41圈主:caolianhui 帖子:33 -
制药工程交流
2019-01-25 10:40圈主:polysciences 帖子:30 -
健康管理
2019-01-25 10:40圈主:neuromics 帖子:20 -
发酵技术
2019-01-25 10:39圈主:fitzgerald 帖子:17 -
医学肿瘤学临床试验
2019-01-25 10:39圈主:bma 帖子:58
xysheep是来踢馆的?! :razz:matlab PK R