l**********1 发帖数: 5204 | 1 Continue:
第四乐章 Finale
找有关的PhD dissertation 里边的 R source code program
while U can debug it or even rewrite it for another task,
then you already masted NGS coding skills.
比如
http://www.dspace.cam.ac.uk/handle/1810/218542
DSpace at Cambridge
title: Genome-wide analyses using bead-based microarrays
Authors: Dunning, Mark J
Issue Date: 4-Sep-2008
Files in This Item:
File Description Size Format
dunning_thesis_.pdf 10.47 MB Adobe PDF
its Appendix B
R source Code f... 阅读全帖 |
|
S*A 发帖数: 7142 | 2 是使用 python mathplotlib.
在 Fedora 下面如果没有 mathplotlib 的话
yum install python-mathplotlib
就可以了
生成 5x4 个 bull's eye. 程序很短,大家可以自己调参数。
这个程序运行後生成 target.pdf. 这个 pdf 的好处是矢量图。
可以无限放大没有颗粒的。
我的喜好是边上留多一点。这样铁喵比较多白边可以看。
中间多一点比较好,这样可以少打几张纸,比较小农。
size 是 bull's eye 的大小, width 是环的宽度。
xn, yn 是有多少个 bull's eye.
================== target.py ===============
#!/usr/bin/python
import matplotlib
from matplotlib.patches import Circle, Wedge, Rectangle
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.p... 阅读全帖 |
|
l**k 发帖数: 1755 | 3 It is all in the help in matlab
[AX,H1,H2] = plotyy(x,y1,x,y2,'plot');
set(AX(1),'YLim',[-100 100])
set(AX(2),'YLim',[-100 100]) |
|
y******d 发帖数: 65 | 4 graph on the left
plot(1,1,type="n",xlim=c(1,5),ylim=c(1,5))
lines(c(2:4),c(4:2),lty=1,col="red")
points(2,4,pch=21,col="blue")
points(4,2,pch=21,col="blue")
graph on the right
plot(1,1,type="n",xlim=c(1,5),ylim=c(1,5))
lines(c(1:2),rep(2,length(c(1:2))),lty=1,col="red")
lines(c(2:3),rep(3,length(c(1:2))),lty=1,col="red")
lines(c(3:4),rep(4,length(c(1:2))),lty=1,col="red")
points(1,2,pch=21,col="blue")
points(2,2,pch=19,col="blue")
points(2,3,pch=21,col="blue")
points(3,3,pch=19,col="blue")
poin... 阅读全帖 |
|
a********e 发帖数: 78 | 5 y <- rnorm(3000, mean = c, sd = d) 产生的是3000个点。
x <- seq(along = y) 产生的是对应于y的一个数组,以用于画图。
plot(y ~ x, type = "l", ylim = c(a, b)) 因为有ylim 的存在所以画出的图应该理
论上少于3000 个点。我理解的对吗?
我现在所要模拟的是这样一种情况,我知道A 应该属于[-8,10], 但我又想A 符合
normal distribution, mean =0, standard deviation =3. 我这种设计是不是不符合
逻辑,因为normal(mean=0, std=3) 总会有点落在[-8,10]以外得? |
|
t*****w 发帖数: 254 | 6 When I had my job interview, they always tested my SAS skill.However I use R
all the time. To help your preparation, read my R codes to see how much you
can understand it.
%in%
?keyword
a<-matrix(0,nrow=3,ncol=3,byrow=T)
a1 <- a1/(t(a1)%*%spooled%*%a1)^.5 #standadization in discrim
a1<- a>=2; a[a1]
abline(h = -1:5, v = -2:3, col = "lightgray", lty=3)
abline(h=0, v=0, col = "gray60")
abs(r2[i])>r0
aggregate(iris[,1:4], list(iris$Species), mean)
AND: &; OR: |; NOT: !
anova(lm(data1[,3]~data1[,1... 阅读全帖 |
|
l******o 发帖数: 3764 | 7 怎么能弄出个legend来,显示红线和蓝线都是什么?
查了半天也没查到
my code
====================
pl <- ggplot (tab.dat) +
geom_point(data=tab.dat, aes(TAD, DV), colour="#444444", size=3, shape=1
) + #default shape is closed circle
geom_line(data=vpc.dat, aes( (vpc.dat$upper+vpc.dat$lower)/2, vpc.dat[["
X50.sim"]]), size=1.5, colour="#882222") +
geom_line(data=vpc.dat, aes( (vpc.dat$upper+vpc.dat$lower)/2, vpc.dat[["
X5.sim"]]), size=1.5, linetype="dashed", colour="#222288") +
geom_line(data=vpc.dat, aes( (vpc.d... 阅读全帖 |
|
|
a********l 发帖数: 39524 | 9 98-100 was just a made up example, my work involves more complexity than
that, more like ylim['don't know where i came from','unknown location i am
headed to']. but boy do i get some serious joy out of finding solutions to
dumb problems! |
|
k*****e 发帖数: 22013 | 10 clf; clc; clear all;
syms x y
eq1 = ((x/7)^2*sqrt(abs(abs(x)-3)/(abs(x)-3))+(y/3)^2*sqrt(abs(y+3/7*sqrt(33
))/(y+3/7*sqrt(33)))-1);
eq2 = (abs(x/2)-((3*sqrt(33)-7)/112)*x^2-3+sqrt(1-(abs(abs(x)-2)-1)^2)-y);
eq3 = (9*sqrt(abs((abs(x)-1)*(abs(x)-.75))/((1-abs(x))*(abs(x)-.75)))-8*abs(
x)-y);
eq4 = (3*abs(x)+.75*sqrt(abs((abs(x)-.75)*(abs(x)-.5))/((.75-abs(x))*(abs(x)
-.5)))-y);
eq5 = (2.25*sqrt(abs((x-.5)*(x+.5))/((.5-x)*(.5+x)))-y);
eq6 = (6*sqrt(10)/7+(1.5-.5*abs(x))*sqrt(abs(abs(x)-1)/(abs(x)-1... 阅读全帖 |
|
R*******y 发帖数: 19 | 11 xlim/ylim命令,axis命令,都必须是偶数个输入参数。[x_min x_max]必须要同时输入
。假设现在我想要只调整x_min,对x_max则用系统自动生成的那个值,程序里的语句该
如何写呢?
谢谢! |
|
c*u 发帖数: 916 | 12 图像一般不存成.fig的。image object直接上级是Axes.你可以把那个Axes里面用
得上的object和property,比如CData, XLim, YLim etc 存下来就可以了.
Fig的上级是Root,一般Guide生成的GUI就是一个Fig,你在Fig里面读取另外一个
Fig,那么就不再在那个原Fig里面了.多Fig的GUI不适合初学者编程。
所以你要做得很简单,比如你的GUI里面有一个Axes1
axes(handles.axes1)
handles.hImage = imagesc(...);
。。。
function handles.slider_1_Callback(hObject, eventdata, handles)
t1 = get(hObject, 'Value');
CLim = get(handles.axes1, 'CLim')
set(handles.axes1, 'CLim', [t1, CLim(2)]);
end
function handles.slider_2_Callback(hObject, eventdata, han |
|
l*****e 发帖数: 594 | 13 把matlab code帖出来了
f0 = 1e6; % Base frequency
osr = 4; % Over sampling Rate
fs = 2*osr*f0; % sampling frequency
ts = 1/fs;
ncyc = 1; % number of cycles
ts_input = [ones(osr,1);-1*ones(osr,1)];
ts_input = repmat(ts_input,[ncyc 1]);
xt = (0:length(ts_input)-1)*ts;
xt_us = xt*1e6;
figure,
plot(ts_input,'*-')
nfft = 4096;
spc = fftshift(fft(ts_input,nfft));
fs_mhz = fs*1e-6;
fx = (-nfft/2:nfft/2-1)/nfft*fs_mhz;
spc_db = 20*log10(abs(spc));
spc_norm = spc_db-max(spc_db);
figure,
plot(fx,sp... 阅读全帖 |
|
s*****n 发帖数: 2174 | 14 要转换成 y = a + bx 的形势再用 abline(a, b)
plot(0, xlim = c(-10, 10), ylim = c(-10, 10), type = "n")
abline(v = 0, lwd = 2)
abline(h = 0, lwd = 2)
points(-10:10, rep(0, 21), pch = 19)
points(rep(0, 21), -10:10, pch = 19)
abline(25 / 7, -4 / 7, col = "red")
abline(12 / 3, -2 / 3, col = "blue") |
|
|
s*****n 发帖数: 2174 | 16 x 就是 1到3000呗.
a <- 0; b <- 20; c <- 10; d <- 1
y <- rnorm(3000, mean = c, sd = d)
x <- seq(along = y)
plot(y ~ x, type = "l", ylim = c(a, b)) |
|
l***l 发帖数: 22 | 17 # Is this what you want?
x <- c(1, 2); # you can add more points here
y <- c(2, 1); # and here
x11(20, 10);
par(mfrow=c(1, 2));
plot(x, y, xlim = c(0.5, 2.5),
ylim = c(0.5, 2.5),
type = "o", pch = 21, col = "red", )
segments(x0 = x[seq(1, length(x), by=2)],
x1 = x[seq(2, length(x), by=2)],
y0 = y[seq(1, length(y), by=2)],
y1 = y[seq(2, length(y), by=2)],
col = "blue");
x <- c(0, 1, 1, 2, 2, 3); # you can add more points here
y <- c(3, 3, 2, ... 阅读全帖 |
|
b*****e 发帖数: 223 | 18 Havn't fixed the problem in the past two days. My poor R skills .....
I can get the stacked barplot, but whenever I tried to use the option of
beside=T, it gives me the same error message.
mybar <- barplot (as.matrix (trsk01 [c(2,3), c(1,2)]), ylim=c(0, ymax),
axisnames=FALSE, main="Plot of PSI = 6", beside=T )
Error in -0.01 * height : non-numeric argument to binary operator
data is here:
> trsk01
28 29 30 31 32 33 34
35
psi a_I_byp... 阅读全帖 |
|
w*******e 发帖数: 666 | 19 刚开始学习R,主要是想用survivalROC package。想请教下面的问题,非常感谢!
我做10年和1年的time dependt ROC得到的AUC 一样。我用的是survial ROC guide上的
code。做十年的时候只是把cutoff改成了3650还有year改成了10。不知道是不是还有什
么需要改的,为什么结果完全没有区别?
code 如下:
library(survivalROC)
nobs <- NROW(ggtno)
cutoff <- 365
score1= survivalROC(Stime=ggtno$time,
status=ggtno$censor,
marker = ggtno$score,
predict.time = cutoff,span = 0.25*nobs^(-0.20) )
plot(score1$FP, score1$TP, type="l", xlim=c(0,1), ylim=c(0,1),
xlab=paste( "FP", "\n", "AUC = ",round(score1$AUC,3))... 阅读全帖 |
|
l*********a 发帖数: 42 | 20 How can I improve my R plot (see code below) to publishing quality level (i.
e. as good as Tableau graphs or Excel/PPT graphs)?
Thanks!
#----------------total sales amt --------------------
par(bg="white")
plot(t$tot_sales_amt, type="n", axes=FALSE, ann=FALSE, ylim=c(0,1000000))
lines(t$tot_sales_amt, col="blue")
points(t$tot_sales_amt, pch=21, bg="lightcyan", cex=1.5)
axis(2, col.axis="dark blue")
axis(1, at=1:dim(t)[1],lab=paste(substring(t$dt,5,6), '-', substring(t$dt,7,
8), sep=''), col.a... 阅读全帖 |
|
g******2 发帖数: 234 | 21 suppose your data is a data frame with 2 columns: x and y.
data$group <- 1
data$group[data$x < - log(2)] <- 2
data$group[data$x > log(2)] <- 3
plot(data$x[data$group == 1], data$y[data$group == 1], xlab = "x", ylab = "y
", xlim = range(data$x), ylim = range(data$y))
points(data$x[data$group == 2], data$x[data$group == 2], col = "blue")
points(data$x[data$group == 3], data$x[data$group == 3], col = "red") |
|