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

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

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

                                        Add Points to a Plot
                                         到剧情加分

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

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

points is a generic function to draw a sequence of points at the specified coordinates.  The specified character(s) are plotted, centered at the coordinates.
points是一个通用的函数来绘制在指定的坐标点序列。绘制指定的字符(S),在坐标为中心。


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


points(x, ...)

## Default S3 method:[默认方法]
points(x, y = NULL, type = "p", ...)



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

参数:x, y
coordinate vectors of points to plot.
协调点的向量积。


参数:type
character indicating the type of plotting; actually any of the types as in plot.default.
字符,指示策划的类型,实际上在type与plot.default的任何。


参数:...
Further graphical parameters may also be supplied as arguments.  See "Details".
进一步的图形参数,也可以作为参数提供。见“详细资料”。


Details

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

The coordinates can be passed in a plotting structure (a list with x and y components), a two-column matrix, a time series, ....  See xy.coords.  If supplied separately, they must be of the same length.
坐标可以通过在绘图结构(x和y组件的列表),一个两列的矩阵,时间序列,....看到xy.coords。如果单独提供的,它们必须是相同的长度。

Graphical parameters commonly used are
常用的图形参数




pch plotting "character", i.e., symbol to use. This can either be a single character or an integer code for one of a set of graphics symbols.  The full set of S symbols is available with pch=0:18, see the examples below. (NB: R uses circles instead of the octagons used in S.)
pch图字符,即,使用的符号。这可以是一个单一的字符或整数代码为一体的一组图形符号。一套完整的S符号是pch=0:18,看到下面的例子。 (注:R使用圆圈,而不是在学中使用的八角)

Value pch="." (equivalently pch = 46) is handled specially.  It is a rectangle of side 0.01 inch (scaled by cex).  In addition, if cex = 1 (the default), each side is at least one pixel (1/72 inch on the pdf, postscript and xfig devices).
值pch="."(等效pch = 46)是特殊处理。这是一个0.01英寸(cex缩放)方矩形。此外,如果cex = 1(默认),每边至少有一个像素(pdf,postscript和xfig设备的1/72英寸)。

For other text symbols, cex = 1 corresponds to the default fontsize of the device, often specified by an argument pointsize.  For pch in 0:25 the default size is about 75% of the character height (see par("cin")).
对于其他文字符号,cex = 1对应设备的默认字号,往往指定一个参数pointsize。 pch0:25默认的大小,字符的高度大约是75%(见par("cin"))。




col color code or name, see par.
col颜色代码或名称,看到par。




bg background (fill) color for the open plot
bg背景(填充)的颜色为开放的图




cex character (or symbol) expansion: a numerical vector.
cex字符(或符号)的扩展:一个数值向量。




lwd line width for drawing symbols see par.
lwd绘制符号的线宽看到par。

Others less commonly used are lty and lwd for types such as "b" and "l".
其他不太常用的lty和lwd类型,如"b"和"l"。

The graphical parameters pch, col, bg, cex and lwd can be vectors (which will be recycled as needed) giving a value for each point plotted.  If lines are to be plotted (e.g. for type = "b") the first element of lwd is used.
图形参数pch,col,bg,cex和lwd可以是向量(需要将被回收),给予每个点的值绘制。如果要绘制的第一个元素type = "b"使用(例如,lwd)线。

Points whose x, y, pch, col or cex value is NA are omitted from the plot.
点的x,y,pch,col或cex值NA省略图。


“PCH”值----------'pch' values----------

Values of pch are stored internally as integers.  The interpretation is
值pch内部存储为整数。的解释是

NA_integer_: no symbol.
NA_integer_:没有符号。

0:18: S-compatible vector symbols.
0:18:S兼容的矢量符号。

19:25: further R vector symbols.
19:25:进一步研发的矢量符号。

26:31: unused (and ignored).
26:31:未使用(忽略)。

32:127: ASCII characters.
32:127:ASCII字符。

128:255 native characters only in a single-byte locale and for the symbol font.  (128:159 are only used on Windows.)
128:255只有在一个单字节语言环境和本地字符的符号字体。 (128:159只有在Windows上使用。)

-32 ... Unicode point (where supported).
-32 ...的Unicode点(如果支持)。

Note that unlike S (which uses octagons), symbols 1, 10, 13 and 16 use circles.  The filled shapes 15:18 do not include a border.
请注意,不像(第使用八角形),符号1,10,13和16使用圈。填充形状15:18不包括边界。

The following  R plotting symbols are can be obtained with pch=19:25: those with 21:25 can be colored and filled with different colors: col gives the border color and bg the background color (which is "grey" in the figure)
以下ŕ绘制符号都可以得到pch=19:25:21:25可着色,用不同的颜色填充:col给人的边框颜色和bg背景颜色的(这是"grey"图)

pch=19: solid circle,
pch=19:实心圆,

pch=20: bullet (smaller solid circle, 2/3 the size of 19),
pch=20:子弹(较小的实心圆,2/3的大小19),

pch=21: filled circle,
pch=21:实心圆,

pch=22: filled square,
pch=22:填方,

pch=23: filled diamond,
pch=23:充满钻石,

pch=24: filled triangle point-up,
pch=24:充满三角点,

pch=25: filled triangle point down.
pch=25:充满三角点。

Note that all of these both fill the shape and draw a border.  Some care in interpretation is needed when semi-transparent colours are used for both fill and border (and the result might be device-specific and even viewer-specific for pdf).
请注意,所有这些都填补了形状和绘制一个边框。需要照顾一些解释时,半透明的颜色用于填充和边界(其结果可能是特定设备,甚至特定的观众pdf)。

The difference between pch=16 and pch=19 is that the latter uses a border and so is perceptibly larger when lty is large relative to cex.
pch=16和pch=19是后者使用边界等之间的差异较大时lty是大相cex事倍功半。

Values pch=26:31 are currently unused and pch=32:127 give the ASCII characters.  In a single-byte locale pch=128:255 give the corresponding character (if any) in the locale's character set.  Where supported by the OS, negative values specify a Unicode point, so e.g. -0x2642L is a "male sign" and -0x20ACL is the Euro.
值pch=26:31目前闲置pch=32:127ASCII字符。在一个单字节语言环境pch=128:255给予相应的语言环境的字符集字符(如有)。凡由操作系统的支持下,负值指定Unicode点,所以如-0x2642L是男性的标志“和-0x20ACL是欧元。

A character string consisting of a single character is converted to an integer: 32:127 for ASCII characters, and usually to the Unicode point number otherwise.  (In non-Latin-1 single-byte locales, 128:255 will be used for 8-bit characters.)
一个单个字符组成的字符串转换为整数:32:127ASCII字符,通常为Unicode点的数量,否则。 (在非Latin-1的单字节语言环境,128:255将用于8位字符。)

If pch supplied is a logical, integer or character NA or an empty character string the point is omitted from the plot.
如果pch提供的是逻辑,整数或字符NA点是从图省略或空字符串。

If pch is NULL or otherwise of length 0, par("pch") is used.
如果pchNULL或长度为0,否则,par("pch")使用。

If the symbol font (par(font = 5)) is used, numerical values should be used for pch: the range is c(32:126, 160:254) in all locales (but 240 is not defined (used for "apple" on Mac OS) and 160, Euro, may not be present).
如果符号字体(par(font = 5)),数值应用于pch:范围是c(32:126, 160:254)在所有的语言环境(但240没有被定义(用于“苹果”在Mac OS)和160,欧元,可能不存在)。


注意----------Note----------

A single-byte encoding may include the characters in pch=128:255, and if it does, a font may not include all (or even any) of them.
在pch=128:255可能包含一个单字节编码字符,如果这样做,字体可能不包括所有这些(甚至任何)。

Not all negative numbers are valid as Unicode points, and no check is done.  A display device is likely to use a rectangle for (or omit) Unicode points that do not exist or which it does not have a glyph.
不是所有负数为Unicode点是有效的,并没有完成检查。显示设备可能会使用一个矩形(或省略)不存在的,它没有一个字形的Unicode点。


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

The New S Language. Wadsworth & Brooks/Cole.

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

points.formula for the formula method; plot, lines, and the underlying workhorse function plot.xy.
points.formula公式法;plot,lines,和底层主力函数plot.xy的。


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


require(stats) # for rnorm[为rnorm]
plot(-4:4, -4:4, type = "n")# setting up coord. system[设立坐标。系统]
points(rnorm(200), rnorm(200), col = "red")
points(rnorm(100)/2, rnorm(100)/2, col = "blue", cex = 1.5)

op <- par(bg = "light blue")
x <- seq(0,2*pi, len=51)
## something "between type='b' and type='o'":[#什么“=B和类型之间的类型=O”:]
plot(x, sin(x), type="o", pch=21, bg=par("bg"), col = "blue", cex=.6,
main='plot(..., type="o", pch=21, bg=par("bg"))')
par(op)

## Not run: [#无法运行:]
## The figure was produced by calls like[#这个数字是由这样的方法调用]
png("pch.png", height=0.7, width = 7, res = 100, units="in")
par(mar = rep(0,4))
plot(c(-1, 26), 0:1, type="n", axes= FALSE)
text(0:25, 0.6, 0:25, cex = 0.5)
points(0:25, rep(0.3, 26), pch = 0:25, bg = "grey")

## End(Not run)[#结束(不运行)]

##-------- Showing all the extra &amp; some char graphics symbols ---------[#--------显示所有额外的一些字符的图形符号---------]
pchShow <-
  function(extras = c("*",".", "o","O","0","+","-","|","%","#"),[“),]
           cex = 3, ## good for both .Device=="postscript" and "x11"[#良好的设备==“后记”和“X11”]
           col = "red3", bg = "gold", coltext = "brown", cextext = 1.2,
           main = paste("plot symbols :  points (...  pch = *, cex =",
                        cex,")"))
  {
    nex <- length(extras)
    np  <- 26 + nex
    ipch <- 0np-1)
    k <- floor(sqrt(np))
    dd <- c(-1,1)/2
    rx <- dd + range(ix <- ipch %/% k)
    ry <- dd + range(iy <- 3 + (k-1)- ipch %% k)
    pch &lt;- as.list(ipch) # list with integers &amp; strings[与整数和字符串列表]
    if(nex > 0) pch[26+ 1:nex] <- as.list(extras)
    plot(rx, ry, type="n", axes = FALSE, xlab = "", ylab = "",
         main = main)
    abline(v = ix, h = iy, col = "lightgray", lty = "dotted")
    for(i in 1:np) {
      pc <- pch[[i]]
      ## 'col' symbols with a 'bg'-colored interior (where available) :[#col的符号“bg浅色内饰(如适用):]
      points(ix[i], iy[i], pch = pc, col = col, bg = bg, cex = cex)
      if(cextext > 0)
          text(ix[i] - 0.3, iy[i], pc, col = coltext, cex = cextext)
    }
  }

pchShow()
pchShow(c("o","O","0"), cex = 2.5)
pchShow(NULL, cex = 4, cextext = 0, main = NULL)


## ------------ test code for various pch specifications -------------[#------------ PCH各种规格的测试代码-------------]
# Try this in various font families (including Hershey)[尝试各种字体的家庭(包括赫尔希)]
# and locales.  Use sign=-1 asserts we want Latin-1.[和语言环境。使用签署= -1断言我们想要的Latin-1。]
# Standard cases in a MBCS locale will not plot the top half.[在MBCS区域设置的标准的情况下将不绘制的上半部分。]
TestChars <- function(sign=1, font=1, ...)
{
   if(font == 5) { sign <- 1; r <- c(32:126, 160:254)
   } else if (l10n_info()$MBCS) r <- 32:126 else r <- 32:255
   if (sign == -1) r <- c(32:126, 160:255)
   par(pty="s")
   plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="",
        xaxs="i", yaxs="i")
   grid(17, 17, lty=1)
   for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...))
}
TestChars()
try(TestChars(sign=-1))
TestChars(font=5) # Euro might be at 160.  Mac OS has apple at 240.[欧元可能在160。 Mac OS提供了苹果在240。]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-23 06:03 , Processed in 0.046867 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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