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

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

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

                                        Add Text to a Plot
                                         添加文本到一个图

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

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

text draws the strings given in the vector labels at the coordinates given by x and y. y may be missing since xy.coords(x,y) is used for construction of the coordinates.
text绘制向量的坐标labels和xy的字符串。 y自xy.coords(x,y)用于建设的坐标,可以失踪。


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


text(x, ...)

## Default S3 method:[默认方法]
text(x, y = NULL, labels = seq_along(x), adj = NULL,
     pos = NULL, offset = 0.5, vfont = NULL,
     cex = 1, col = NULL, font = NULL, ...)



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

参数:x, y
numeric vectors of coordinates where the text labels should be written.  If the length of x and y differs, the shorter one is recycled.
文本labels应书面坐标的数字向量。如果长度x和y不同,在较短的回收。


参数:labels
a character vector or expression specifying the text to be written.  An attempt is made to coerce other language objects (names and calls) to expressions, and vectors and other classed objects to character vectors by as.character. If labels is longer than x and y, the coordinates are recycled to the length of labels.
一个字符向量或表达式,指定要写入的文字。企图强迫as.character其他语言中的对象(姓名和电话),以表达,向量和其他类的对象,特征向量。如果labels比x和y,坐标被回收到的labels长度较长。


参数:adj
one or two values in [0, 1] which specify the x (and optionally y) adjustment of the labels.  On most devices values outside that interval will also work.
在一个或两个值[0, 1]指定的x(和可选Y)的标签的调整。大多数设备上都超出该时间间隔的值也将正常工作。


参数:pos
a position specifier for the text.  If specified this overrides any adj value given.  Values of 1, 2, 3 and 4, respectively indicate positions below, to the left of, above and to the right of the specified coordinates.
为文本的位置规范。如果指定的话,这将覆盖任何adj给定值。值1,2,3和4,下面分别表明立场,上面左侧,并指定坐标的权利。


参数:offset
when pos is specified, this value gives the offset of the label from the specified coordinate in fractions of a character width.
当pos指定,这个值给出标签的偏移量从指定的坐标系中的一个字符宽度的分数。


参数:vfont
NULL for the current font family, or a character vector of length 2 for Hershey vector fonts.  The first element of the vector selects a typeface and the second element selects a style.  Ignored if labels is an expression.
NULL当前字体的家庭,或一个长度为2赫尔希矢量字体的特征向量。向量的第一个元素选择一个字体和第二个元素选择一种风格。如果labels是一个表达式忽略。


参数:cex
numeric character expansion factor; multiplied by par("cex") yields the final character size. NULL and NA are equivalent to 1.0.
数字字符膨胀系数乘以par("cex")产生的最后一个字符的大小。 NULL和NA1.0是等价的。


参数:col, font
the color and (if vfont = NULL) font to be used, possibly vectors. These default to the values of the global graphical parameters in par().
颜色(如果要使用vfont = NULL)字体,可能向量。这些默认par()全球图形参数的值。


参数:...
further graphical parameters (from par), such as srt, family and xpd.
进一步的图形参数(从par),如srt,family和xpd。


Details

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

labels must be of type character or expression (or be coercible to such a type). In the latter case, quite a bit of mathematical notation is available such as sub- and superscripts, greek letters, fractions, etc.
labels的类型必须是character或expression(或者是这种类型的强制转换)。在后一种情况下,相当多的数学符号位,如分标,希腊字母,分数等

adj allows adjustment of the text with respect to (x,y). Values of 0, 0.5, and 1 specify left/bottom, middle and right/top alignment, respectively.  The default is for centered text, i.e., adj = c(0.5, 0.5).  Accurate vertical centering needs character metric information on individual characters which is only available on some devices.  Vertical alignment is done slightly differently for character strings and for expressions: adj=c(0,0) means to left-justify and to align on the baseline for strings but on the bottom of the bounding box for expressions. This also affects vertical centering: for strings the centering excludes any descenders whereas for expressions it includes them.
adj允许调整文本的尊重(x,y)。值指定为0,0.5,1左/底部,中部和右/顶部对齐,分别。默认是居中的文本,即adj = c(0.5, 0.5)。准确的垂直居中需要单个字符的字符度量信息,这是仅在某些设备上。垂直对齐方式略有不同,字符串和表达式:adj=c(0,0)意味着左对齐和上对齐字符串的基线,但表达式的边界框的底部。这也影响垂直居中:字符串居中下伸,而排除任何的表达式,它包括他们。

The pos and offset arguments can be used in conjunction with values returned by identify to recreate an interactively labelled plot.
pos和offset参数,可以在identify退回重新交互标记图的值一起使用。

Text can be rotated by using graphical parameters srt (see par); this rotates about the centre set by adj.
文本可以旋转,通过使用图形参数srt(见par);旋转中心组关于adj。

Graphical parameters col, cex and font can be vectors and will then be applied cyclically to the labels (and extra values will be ignored).  NA values of font are replaced by par("font").
图形参数col,cex和font可以是向量,然后将应用循环labels(和额外的值将被忽略)。 NA值font取代par("font")的。

Labels whose x, y, labels, cex or col value is NA are omitted from the plot.
标签的x,y,labels,cex或col值NA从图省略。

What happens when font = 5 (the symbol font) is selected can be both device- and locale-dependent.  Most often labels will be interpreted in the Adobe symbol encoding, so e.g. "d" is delta, and "\300" is aleph.
当font = 5(符号字体)被选中,既可以是设备和语言环境的依赖,会发生什么。最常见的labels将解释在Adobe符号编码,因此如"d"三角洲,"\300"是ALEPH。


欧元符号----------Euro symbol----------

The Euro symbol was introduced relatively recently and may not be available in older fonts.  In recent versions of Adobe symbol fonts it is character 160, so text(x, y, "\xA0", font = 5) may work. People using Western European locales on Unix-alikes can probably select ISO-8895-15 (Latin-9) which has the Euro as character 165: this can also be used for postscript and pdf. It is \u20ac in Unicode, which can be used in UTF-8 locales.
欧元符号是最近推出相对,可能无法在旧字体。在最新版本的Adobe符号字体,它是160字符,所以text(x, y, "\xA0", font = 5)工作。在Unix相似者使用西欧语言环境的人,大概可以选择的ISO-8895-15(拉丁语-9),其中有165字符的欧元,这也可以用于postscript和pdf。这是\u20ac在Unicode中,可以在UTF-8语言环境中使用。

In all the European Windows encodings the Euro is symbol 128 and \u20ac will work in all locales: however not all fonts will include it.  It is not in the symbol font used for windows and related devices, including the Windows printer.
在所有欧洲的Windows编码的欧元符号128\u20ac将在所有的语言环境,但不是所有的字体将它列入。它是不是在windows及相关设备,包括Windows打印机所使用的符号字体。


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

The New S Language. Wadsworth & Brooks/Cole.


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

text.formula for the formula method; mtext, title, Hershey for details on Hershey vector fonts, plotmath for details and more examples on mathematical annotation.
text.formula公式法;mtext,title,Hershey为赫尔希矢量字体的细节,plotmath数学注释的细节和更多的例子。


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


plot(-1:1,-1:1, type = "n", xlab = "Re", ylab = "Im")
K <- 16; text(exp(1i * 2 * pi * (1:K) / K), col = 2)

## The following two examples use latin1 characters: these may not[#下面两个例子使用latin1字符:这些可能不是]
## appear correctly (or be omitted entirely).[#正确显示(或完全省略)。]
plot(1:10, 1:10, main = "text(...) examples\n~~~~~~~~~~~~~~",
     sub = "R is GNU
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-23 07:25 , Processed in 0.028745 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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