找回密码
 注册
查看: 5067|回复: 0

R语言:identify()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 20:11:58 | 显示全部楼层 |阅读模式
identify(graphics)
identify()所属R语言包:graphics

                                        Identify Points in a Scatter Plot
                                         在散点图中找出点

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

identify reads the position of the graphics pointer when the (first) mouse button is pressed.  It then searches the coordinates given in x and y for the point closest to the pointer. If this point is close enough to the pointer, its index will be returned as part of the value of the call.
identify读取(一)鼠标按钮被按下时,图形指针的位置。然后,它搜索的坐标定在x和y最接近的指针点。如果这一点是足够接近的指针,其指数将返回呼叫的价值的一部分。


用法----------Usage----------


identify(x, ...)

## Default S3 method:[默认方法]
identify(x, y = NULL, labels = seq_along(x), pos = FALSE,
         n = length(x), plot = TRUE, atpen = FALSE, offset = 0.5,
         tolerance = 0.25, ...)



参数----------Arguments----------

参数:x,y
coordinates of points in a scatter plot.  Alternatively, any object which defines coordinates (a plotting structure, time series etc: see xy.coords) can be given as x, and y left missing.
散点图中的点的坐标。另外,可以定义坐标(刻绘结构,时间序列等xy.coords)任何对象为x,y离开失踪。


参数:labels
an optional character vector giving labels for the points.  Will be coerced using as.character, and recycled if necessary to the length of x.  Excess labels will be discarded, with a warning.
可选的特征向量点的标签。将强制使用as.character,如果有必要回收x长度。多余的标签将被丢弃,一个警告。


参数:pos
if pos is TRUE, a component is added to the return value which indicates where text was plotted relative to each identified point: see Value.
如果pos是TRUE,一个组件被添加到文本相对于每一个确定的点绘制的返回值,这表明:看到价值。


参数:n
the maximum number of points to be identified.
确定点的最大数量。


参数:plot
logical: if plot is TRUE, the labels are printed near the points and if FALSE they are omitted.
plot逻辑:如果TRUE,标签印制点附近,如果FALSE,“他们被省略。


参数:atpen
logical: if TRUE and plot = TRUE, the lower-left corners of the labels are plotted at the points clicked rather than relative to the points.
逻辑:如果TRUE和plot = TRUE,标签的左下角绘制点点击,而不是相对点。


参数:offset
the distance (in character widths) which separates the label from identified points.  Negative values are allowed.  Not used if atpen = TRUE.
分离从标签标识点的距离(字符宽度)。负值是不允许的。如果atpen = TRUE不使用。


参数:tolerance
the maximal distance (in inches) for the pointer to be "close enough" to a point.
指针的最大距离为(英寸)是“足够接近到一个点。


参数:...
further arguments passed to par such as cex, col and font.
通过进一步的论据parcex,col和font的。


Details

详情----------Details----------

identify is a generic function, and only the default method is described here.
identify是一个通用的功能,只有这里所描述的默认方法。

identify is only supported on screen devices such as X11, windows and quartz.  On other devices the call will do nothing.
identify只支持屏幕设备,如X11,windows和quartz。在其他设备上调用不会做任何事情。

Clicking near (as defined by tolerance) a point adds it to the list of identified points.  Points can be identified only once, and if the point has already been identified or the click is not near any of the points a message is printed immediately on the R console.
点击附近(定义tolerance)一个点,把它添加到确定点的名单。积分可确定只有一次,如果这一点已被确定或点击点附近没有打印一条消息立即在R控制台。

If plot is TRUE, the point is labelled with the corresponding element of labels.  If atpen is false (the default) the labels are placed below, to the left, above or to the right of the identified point, depending on where the pointer was relative to the point.  If atpen is true, the labels are placed with the bottom left of the string's box at the pointer.
如果plot是TRUE,相应的元素标记的labels点。 atpen如果是假的(默认)标签放在下面,左边,上面或确定点取决于指针是相对点,权。 atpen如果是真实的,留在指针字符串的盒子底部放置标签。

The identification process is terminated by clicking the second button and selecting "Stop" from the menu, or from the "Stop" menu on the graphics window.
通过点击第二个按钮,从菜单中选择,或从图形窗口的菜单上的一站式的一站式的鉴定过程中被终止。

On most devices which support identify, successful selection of a point is indicated by a bell sound unless options(locatorBell = FALSE) has been set.
在大多数设备支持identify的,选择一个点的成功表示除非options(locatorBell = FALSE)已成立由钟声。

If the window is resized or hidden and then exposed before the identification process has terminated, any labels drawn by identify will disappear.  These will reappear once the identification process has  terminated and the window is resized or hidden and exposed again. This is because the labels drawn by identify are not recorded in the device's display list until the identification process has terminated.
如果窗口大小或隐藏起来,然后暴露查验过程已经终止前,任何identify绘制的标签会消失。这些将再次出现一次查验过程已经终止和调整窗口的大小或隐藏,再次暴露。这是标签因为identify绘制不记录在设备的显示列表,直到识别进程已终止。

If you interrupt the identify call this leaves the graphics device in an undefined state, with points labelled but labels not recorded in the display list.  Copying a device in that state (e.g. saving the plot from the window's menu) will give unpredictable results.
如果中断identify调用未定义的状态留在与标记,但标签不显示列表中的记录点,图形设备。复制设备(例如,保存从窗口菜单中的图)在该州将给不可预知的结果。


值----------Value----------

If pos is FALSE, an integer vector containing the indices of the identified points, in the order they were identified.
如果posFALSE,整数向量包含确定点的指数,以便在他们被确定。

If pos is TRUE, a list containing a component ind, indicating which points were identified and a component pos, indicating where the labels were placed relative to the identified points (1=below, 2=left, 3=above, 4=right and 0=no offset, used if atpen = TRUE).
如果pos是TRUE,一个列表,其中包含一个组件ind,说明这点被确定和组件pos,说明标签被放在相对确定点( 1 =以下,2 =左,3 =以上,4 =权利和0 =无偏移,用于如果atpen = TRUE)。


技术性问题----------Technicalities----------

The algorithm used for placing labels is the same as used by text if pos is specified there, the difference being that the position of the pointer relative the identified point determines pos in identify.
用于放置标签的算法是一样的作为text如果pos指定有,区别在于指针的相对位置所确定的点确定pos使用<X >

For labels placed to the left of a point, the right-hand edge of the string's box is placed offset units to the left of the point, and analogously for points to the right.  The baseline of the text is placed below the point so as to approximately centre string vertically. For labels placed above or below a point, the string is centered horizontally on the point.  For labels placed above, the baseline of the text is placed offset units above the point, and for those placed below, the baseline is placed so that the top of the string's box is approximately offset units below the point.  If you want more precise placement (e.g. centering) use plot = FALSE and plot via text or points: see the examples.
字符串的盒子的右边缘放置一个点到左边的标签,放在offset单位点左侧,类似于点的权利。约中心字符串垂直文本的基线点放在下面。为安置点的上方或下方的标签,字符串是水平居中上的点。放在上面的标签,文本基线放置点以上offset单位,和那些放在下面,放在基线使字符串的盒子的顶部是约offset以下单位点。如果你想使用更精确的位置(如居中)plot = FALSE“图通过text或points:看到的例子。


参考文献----------References----------

The New S Language. Wadsworth &amp; Brooks/Cole.

参见----------See Also----------

locator, text.
locator,text。

dev.capabilities to see if it is supported.
dev.capabilities,看它是否支持。


举例----------Examples----------


## A function to use identify to select points, and overplot the[#功能使用标识选择点,并overplot]
## points with another symbol as they are selected[另一个符号#作为他们选择的点]
identifyPch <- function(x, y=NULL, n=length(x), pch=19, ...)
{
    xy <- xy.coords(x, y); x <- xy$x; y <- xy$y
    sel <- rep(FALSE, length(x)); res <- integer(0)
    while(sum(sel) < n) {
        ans <- identify(x[!sel], y[!sel], n=1, plot=FALSE, ...)
        if(!length(ans)) break
        ans <- which(!sel)[ans]
        points(x[ans], y[ans], pch = pch)
        sel[ans] <- TRUE
        res <- c(res, ans)
    }
    res
}

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-24 14:33 , Processed in 0.023727 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表