一个问题和一个元问题:
在R统计语言中,我想给出一个独立的偏移量,当打印一组值到一个图。
为单个字符串指定偏移量很容易:
text(0,0, "offset this", adj=0)我正在从一个矩阵中打印多个值;称为database,列为x、y、label和offset。
attach(database)
text(x,y, label, adj=offset)这不管用。很明显,adj只接受前两个值,将它们解释为水平和垂直偏移。我尝试给它一个2Xn或nx2矩阵,但它仍然只使用前两个值。
当然,我可以这么做:
text(x+offset*strwidth(label), y, label)但我想知道我是否可以用adj代替。
元问题:
Is there any way to look at the code for a function that does not show up when you type the name of the function?R版linux-gnu 3.2.1 2015-06-18
发布于 2015-08-29 20:52:29
首先,不要使用attach。如果有多个值要传递给一个未准备好的函数,则可以尝试mapply>
> plot(NA, xlim=c(0,10), ylim=c(0,10))
> invisible( mapply(text, y=1:10, x=1, labels="ttttttt" , adj=runif(10) ) )你知道'adj‘是标签参数的相对大小,对吗?
https://stackoverflow.com/questions/32290334
复制相似问题