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

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

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

                                        3d Scatter Plot and Wireframe Surface Plot
                                         3D散点图和线框曲面图

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

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

Generic functions to draw 3d scatter plots and surfaces.  The "formula" methods do most of the actual work.
通用函数来绘制3D散点图和表面。 "formula"方法做最实际的工作。


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


cloud(x, data, ...)
wireframe(x, data, ...)

## S3 method for class 'formula'[类formula的方法]
cloud(x,
      data,
      allow.multiple = is.null(groups) || outer,
      outer = FALSE,
      auto.key = FALSE,
      aspect = c(1,1),
      panel.aspect = 1,
      panel = lattice.getOption("panel.cloud"),
      prepanel = NULL,
      scales = list(),
      strip = TRUE,
      groups = NULL,
      xlab,
      ylab,
      zlab,
      xlim = if (is.factor(x)) levels(x) else range(x, finite = TRUE),
      ylim = if (is.factor(y)) levels(y) else range(y, finite = TRUE),
      zlim = if (is.factor(z)) levels(z) else range(z, finite = TRUE),
      at,
      drape = FALSE,
      pretty = FALSE,
      drop.unused.levels,
      ...,
      lattice.options = NULL,
      default.scales =
      list(distance = c(1, 1, 1),
           arrows = TRUE,
           axs = axs.default),
      default.prepanel = lattice.getOption("prepanel.default.cloud"),
      colorkey,
      col.regions,
      alpha.regions,
      cuts = 70,
      subset = TRUE,
      axs.default = "r")

## S3 method for class 'formula'[类formula的方法]
wireframe(x,
          data,
          panel = lattice.getOption("panel.wireframe"),
          default.prepanel = lattice.getOption("prepanel.default.wireframe"),
          ...)

## S3 method for class 'matrix'
cloud(x, data = NULL, type = "h",
      zlab = deparse(substitute(x)), aspect, ...,
      xlim, ylim, row.values, column.values)

## S3 method for class 'table'
cloud(x, data = NULL, groups = FALSE,
      zlab = deparse(substitute(x)),
      type = "h", ...)

## S3 method for class 'matrix'
wireframe(x, data = NULL,
          zlab = deparse(substitute(x)), aspect, ...,
          xlim, ylim, row.values, column.values)



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

参数:x
The object on which method dispatch is carried out.  For the "formula" methods, a formula of the form z ~ x       * y | g1 * g2 * ..., where z is a numeric response, and x, y are numeric values. g1, g2, ..., if present, are conditioning variables used for conditioning, and must be either factors or shingles. In the case of wireframe, calculations are based on the assumption that the x and y values are evaluated on a rectangular grid defined by their unique values.  The grid points need not be equally spaced.  For wireframe, x, y and z may also be matrices (of the same dimension), in which case they are taken to represent a 3-D surface parametrized on a 2-D grid (e.g., a sphere). Conditioning is not possible with this feature. See details below.  Missing values are allowed, either as NA values in the z vector, or missing rows in the data frame (note however that in that case the X and Y grids will be determined only by the available values). For a grouped display (producing multiple surfaces), missing rows are not allowed, but NA-s in z are.  Both wireframe and cloud have methods for matrix objects, in which case x provides the z vector described above, while its rows and columns are interpreted as the x and y vectors respectively.  This is similar to the form used in persp.  
对象的方法调度进行。 "formula"方法,形式的公式z ~ x       * y | g1 * g2 * ...,其中z是一个数字的反应,并x,y数值。 g1, g2, ...,如果存在的话,是空调使用的调节变量,必须是任何因素或带状疱疹。在wireframe的情况下,计算依据的假设,x和y其独特的价值定义的矩形网格评估值。网格点不必等距离。 wireframe,x,y和z也可能是矩阵(相同尺寸),在这种情况下,他们采取代表一个3-D表面的参数化一个2-D网格(例如,一个球体)。空调是不可能有此功能。详见下文。遗漏值是允许的,无论是作为NAz向量,或丢失数据框的行的值(注意,在这种情况下,X和Ÿ电网将仅受可用值确定) 。分组显示(生产多个曲面),不得丢失的行,但NA-Sz。既wireframe和cloud的方法matrix对象,在这种情况下,x提供z向量如上所述,而其行和列的解释x和y向量分别。这是类似persp形式。


参数:data
for the "formula" methods, an optional data frame in which variables in the formula (as well as groups and subset, if any) are to be evaluated.  data should not be specified except when using the "formula" method.  
"formula"方法,一个可选的数据框在公式中的变量(以及groups和subset,如果有的话)进行评估。 data不应该被指定使用"formula"方法时除外。


参数:row.values, column.values
Optional vectors of values that define the grid when x is a matrix.  row.values and column.values must have the same lengths as nrow(x) and ncol(x) respectively.  By default, row and column numbers.  
可选的值定义网格时x是一个矩阵向量。 row.values和column.valuesnrow(x)和ncol(x)分别必须有相同的长度。默认情况下,行数和列数。

These arguments are documented in the help page for xyplot.  For the cloud.table method, groups must be a logical indicating whether the last dimension should be used as a grouping variable as opposed to a conditioning variable.  This is only relevant if the table has more than 2 dimensions.  
这些参数都记录在帮助页面xyplot。对于方法cloud.table,groups必须是一个逻辑表明是否最后一维的,应作为分组变量,而不是一个调节变量。这仅仅是相关的,如果表中有2个以上的尺寸。


参数:type
type of display in cloud (see panel.3dscatter for details).  Defaults to "h" for the matrix method.  
cloud(见panel.3dscatter细节)显示类型。默认"h"matrix方法。


参数:aspect, panel.aspect
Unlike other high level functions, aspect is taken to be a numeric vector of length 2, giving the relative aspects of the y-size/x-size and z-size/x-size of the enclosing cube.  The usual role of the aspect argument in determining the aspect ratio of the panel (see xyplot for details) is played by panel.aspect, except that it can only be a numeric value.  For the matrix methods, the default y/x aspect is ncol(x) / nrow(x) and the z/x aspect is the smaller of the y/x aspect and 1.  
不同于其他高级功能,aspect是一个长度为2的数字向量,使相对封闭的立方体的y-size/x-size和z-size/x-size方面。 aspect参数确定面板的长宽比通常的作用(见xyplot细节)panel.aspect出场,除了它只能是一个数值。 matrix方法,默认的y / x的方面是ncol(x) / nrow(x)Z / X方面是小y / x的方面和1。


参数:panel
panel function used to create the display.  See panel.cloud for (non-trivial) details.  
面板功能用于创建显示。看到panel.cloud(非平凡)细节。


参数:default.prepanel
Fallback prepanel function.  See xyplot.  
后备prepanel功能。看到xyplot。


参数:scales
a list describing the scales.  As with other high level functions (see xyplot for details), this list can contain parameters in name=value form.  It can also contain components with the special names x, y and z, which can be similar lists with axis-specific values overriding the ones specified in scales.   The most common use for this argument is to set arrows=FALSE, which causes tick marks and labels to be used instead of arrows being drawn (the default).  Both can be suppressed by draw=FALSE.  Another special component is distance, which specifies the relative distance of the axis label from the bounding box.  If specified as a component of scales (as opposed to one of scales$z etc), this can be (and is recycled if not) a vector of length 3, specifying distances for the x, y and z labels respectively.  Other components that work in the scales argument of xyplot etc. should also work here (as long as they make sense), including explicit specification of tick mark locations and labels.  (Not everything is implemented yet, but if you find something that should work but does not, feel free to bug the maintainer.)  Note, however, that for these functions scales cannot contain information that is specific to particular panels.  If you really need that, consider using the scales.3d argument of panel.cloud.  
列表描述鳞。 (见xyplot细节)与其他高层次的功能,这个列表可以包含参数名称=值的形式。它也可以包含组件与特殊的名字x,y和z,它可以与特定轴覆盖scales指定的值是类似的名单。这种说法最常见的用途是设置的arrows=FALSE,导致刻度线和标签,而不是被用于绘制的箭头(默认)。既可以抑制由draw=FALSE。另一种特殊的成分是的distance,它指定轴标签的边界框的相对距离。如果指定为scales(scales$z等反对)的一个组成部分,这可以是一个长度为3的向量(如果不回收),指定为X,Y和Z的距离标签分别。 scalesxyplot等参数的其他部件也应该在这里工作(只要他们有意义),包括明确的刻度位置和标签的规范。 (不是一切都尚未实现,但如果你找到了工作,但没有,感觉免费错误维护者。)注意,但是,这些功能scales不能包含的信息,具体到特定的面板。如果你真的需要,可以考虑使用scales.3dpanel.cloud参数。


参数:axs.default
Unlike 2-D display functions, cloud does not expand the bounding box to slightly beyound the range of the data, even though it should.  This is primarily because this is the natural behaviour in wireframe, which uses the same code.  axs.default is intended to provide a different default for cloud. However, this feature has not yet been implemented.  
与2-D显示功能,cloud不扩大边界框,略有beyound数据的范围,即使它应该。这主要是因为这是wireframe,它使用相同的代码自然的行为。 axs.default旨在提供一个cloud不同的默认。但是,此功能尚未得到落实。


参数:zlab
Specifies a label describing the z variable in ways similar to xlab and ylab (i.e. “grob”, character string, expression or list) in other high level functions.  Additionally, if zlab (and xlab and ylab) is a list, it can contain a component called rot, controlling the rotation for the label  
指定一个标签描述xlab和ylab(即“GROB”的,字符串,表达式或列表)其他高级功能类似的方式z变量。此外,如果zlab(和xlab和ylab)是一个列表,它可以包含一个组件称为rot,旋转控制标签


参数:zlim
limits for the z-axis. Similar to xlim and ylim in other high level functions  
Z轴的限制。类似xlim和ylim其他高层次功能


参数:drape
logical, whether the wireframe is to be draped in color. If TRUE, the height of a facet is used to determine its color in a manner similar to the coloring scheme used in levelplot.  Otherwise, the background color is used to color the facets.  This argument is ignored if shade = TRUE (see panel.3dwire).  
逻辑,无论是线框是在颜色披上。如果TRUE,一个面的高度是用类似的方式levelplot使用的着色方案,以确定其颜色。否则,背景颜色使用颜色方面。此参数将被忽略,如果shade = TRUE(见panel.3dwire)。


参数:at, col.regions, alpha.regions
these arguments are analogous to those in levelplot. if drape=TRUE, at gives the vector of cutpoints where the colors change, and col.regions the vector of colors to be used in that case.  alpha.regions determines the alpha-transparency on supporting devices.  These are passed down to the panel function, and also used in the colorkey if appropriate.  The default for col.regions and alpha.regions is derived from the Trellis setting "regions"  
这些论点是类似于levelplot。如果drape=TRUE,at给出了矢量的切点的颜色变化,col.regions向量在这种情况下要使用的颜色。 alpha.regions决定对配套设备的alpha透明度。这些流传下来的面板功能,并且如果适当的colorkey使用。 col.regions和alpha.regions网格设置"regions"派生默认的


参数:cuts
if at is unspecified, the approximate number of cutpoints if drape=TRUE  
如果at是不确定的,近似数的切点,如果drape=TRUE


参数:pretty
whether automatic choice of cutpoints should be prettfied  
是否自动切点的选择应prettfied


参数:colorkey
logical indicating whether a color key should be drawn alongside, or a list describing such a key.  See levelplot for details.  
逻辑表示颜色键是否应制定旁边,或列表描述这样一个关键。看到levelplot详情。


参数:...
Any number of other arguments can be specified, and are passed to the panel function.  In particular, the arguments distance, perspective, screen and R.mat are very important in determining the 3-D display.  The argument shade can be useful for wireframe calls, and controls shading of the rendered surface.  These arguments are described in detail in the help page for panel.cloud.  Additionally, an argument called zoom may be specified, which should be a numeric scalar to be interpreted as a scale factor by which the projection is magnified.  This can be useful to get the variable names into the plot.  This argument is actually only used by the default prepanel function.  
可以指定任何其他参数,并传递给面板功能。 ,特别是参数distance,perspective,screen和R.mat是非常重要的,在确定3-D显示。的论点shade是有用的为wireframe电话,和控制表面呈现的阴影。这些参数在帮助页面描述panel.cloud细节。此外,一种说法叫zoom可以指定,这应该是一个数字标量将被放大投影作为其中规模因素解释。进入剧情的变量名,这可能是有用的。这种说法实际上只使用默认prepanel功能。


Details

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

These functions produce three dimensional plots in each panel (as long as the default panel functions are used).  The orientation is obtained as follows: the data are scaled to fall within a bounding box that is contained in the [-0.5, 0.5] cube (even smaller for non-default values of aspect).  The viewing direction is given by a sequence of rotations specified by the screen argument, starting from the positive Z-axis. The viewing point (camera) is located at a distance of 1/distance from the origin. If perspective=FALSE, distance is set to 0 (i.e., the viewing point is at an infinite distance).
这些功能产生在每个小组的三维图(只要使用默认面板功能)。得到如下的方向:数据调整属于边界框是包含在[-0.5,0.5]立方体(甚至为aspect非默认值小)。 screen参数指定的轮换顺序观看方向,开始从积极的Z轴。观赏点(相机)坐落在1/distance从原点的距离。如果perspective=FALSE,distance设置为0(即观赏点是在一个无限的距离)。

cloud draws a 3-D Scatter Plot, while wireframe draws a 3-D surface (usually evaluated on a grid). Multiple surfaces can be drawn by wireframe using the groups argument (although this is of limited use because the display is incorrect when the surfaces intersect). Specifying groups with cloud results in a panel.superpose-like effect (via panel.3dscatter).
cloud绘制一个3-D散点图,而wireframe绘制3-D面(通常在网格上计算)。多个曲面可以得出wireframe使用groups的说法(尽管这种有限的使用,是因为显示是不正确的表面相交时)。指定groupscloud结果(通过panel.superpose)panel.3dscatter般的效果。“

wireframe can optionally render the surface as being illuminated by a light source (no shadows though). Details can be found in the help page for panel.3dwire. Note that although arguments controlling these are actually arguments for the panel function, they can be supplied to cloud and wireframe directly.
wireframe可以选择呈现表面作为照明光源(虽然没有阴影)。细节可以发现在panel.3dwire的帮助页面。请注意,虽然参数控制这些实际上是面板功能参数,他们可以提供给cloud和wireframe直接。

For single panel plots, wireframe can also plot parametrized 3-D surfaces (i.e., functions of the form f(u,v) = (x(u,v), y(u,v), z(u,v)), where values of (u,v) lie on a rectangle. The simplest example of this sort of surface is a sphere parametrized by latitude and longitude. This can be achieved by calling wireframe with a formula x of the form z~x*y, where x, y and z are all matrices of the same dimension, representing the values of x(u,v), y(u,v) and z(u,v) evaluated on a discrete rectangular grid (the actual values of (u,v) are irrelevant).
单面板图,wireframe还可以绘制参数化的3-D表面(即函数的形式f(U,V)=(X(U,V),Y(U,V),Z(U ,V)),值(U,V)趴在一个矩形。这种表面的简单的例子是一个球体参数化的经度和纬度。这可以通过调用wireframe公式 x的形式z~x*y,其中x,y和z都是同一维度的矩阵,代表x的值(U,V), Y(U,V)和z(U,V)评估一个离散的矩形网格(实际值(U,V)是无关的)。

When this feature is used, the heights used to calculate drape colors or shading colors are no longer the z values, but the distances of (x,y,z) from the origin.
使用此功能时,用来计算drape颜色或底纹颜色的高度不再z值,但(x,y,z)从源头的距离。

Note that this feature does not work with groups, subscripts, subset, etc. Conditioning variables are also not supported in this case.
请注意,此功能不起作用以groups,subscripts,subset,空调等变量,也没有在这种情况下,支持。

The algorithm for identifying which edges of the bounding box are "behind" the points doesn't work in some extreme situations. Also, panel.cloud tries to figure out the optimal location of the arrows and axis labels automatically, but can fail on occasion (especially when the view is from "below" the data). This can be manually controlled by the scpos argument in panel.cloud.
在一些极端的情况下,该算法确定边界框的边缘“背后的”点不起作用。此外,panel.cloud试图找出最佳的箭头和轴标签自动位置,但可以偶尔失败(尤其是当视图是从“下面”的数据)。这可以手动控制在scpospanel.cloud参数。

These and all other high level Trellis functions have several other arguments in common. These are extensively documented only in the help page for xyplot, which should be consulted to learn more detailed usage.
这些和所有其他高层次网格功能,有几个共同的其他参数。这些被广泛记载,只有在帮助页xyplot,应谘询,以了解更详细的用法。


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

An object of class "trellis". The update method can be used to update components of the object and the print method (usually called by default) will plot it on an appropriate plotting device.
对象类"trellis"。 update方法可以用来更新的对象和print方法(通常称为默认情况下),将适当的绘图设备上绘制它的组成部分。


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

There is a known problem with grouped wireframe displays when the (x, y) coordinates represented in the data do not represent the full evaluation grid.  The problem occurs whether the grouping is specified through the groups argument or through the formula interface, and currently causes memory access violations.  Depending on the circumstances, this is manifested either as a meaningless plot or a crash.  To work around the problem, it should be enough to have a row in the data frame for each grid point, with an NA
有一个已知的问题与分组wireframe显示时(X,Y)坐标数据为代表的,并不代表全面评估电网。出现问题的分组是否是通过groups参数指定或通过公式界面,目前导致内存访问冲突。视情况而定,这表现为一个毫无意义的图或崩溃。为了解决这个问题,它应该是足有一排在每个网格点的数据框,NA


作者(S)----------Author(s)----------


Deepayan Sarkar <a href="mailtoeepayan.Sarkar@R-project.org">Deepayan.Sarkar@R-project.org</a>



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

Visualization with R, Springer. http://lmdvr.r-forge.r-project.org/

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

Lattice for an overview of the package, as well as  xyplot, levelplot, panel.cloud.
Lattice包的概述,以及xyplot,levelplot,panel.cloud。

For interaction, see panel.identify.cloud.
互动,看到panel.identify.cloud。


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


## volcano  ## 87 x 61 matrix[火山###87×61矩阵]
wireframe(volcano, shade = TRUE,
          aspect = c(61/87, 0.4),
          light.source = c(10,0,10))

g <- expand.grid(x = 1:10, y = 5:15, gr = 1:2)
g$z <- log((g$x^g$g + g$y^2) * g$gr)
wireframe(z ~ x * y, data = g, groups = gr,
          scales = list(arrows = FALSE),
          drape = TRUE, colorkey = TRUE,
          screen = list(z = 30, x = -60))

cloud(Sepal.Length ~ Petal.Length * Petal.Width | Species, data = iris,
      screen = list(x = -90, y = 70), distance = .4, zoom = .6)

## cloud.table[#cloud.table]

cloud(prop.table(Titanic, margin = 1:3),
      type = c("p", "h"), strip = strip.custom(strip.names = TRUE),
      scales = list(arrows = FALSE, distance = 2), panel.aspect = 0.7,
      zlab = "roportion")[, 1]

## transparent axes[#透明轴]

par.set <-
    list(axis.line = list(col = "transparent"),
         clip = list(panel = "off"))
print(cloud(Sepal.Length ~ Petal.Length * Petal.Width,
            data = iris, cex = .8,
            groups = Species,
            main = "Stereo",
            screen = list(z = 20, x = -70, y = 3),
            par.settings = par.set,
            scales = list(col = "black")),
      split = c(1,1,2,1), more = TRUE)
print(cloud(Sepal.Length ~ Petal.Length * Petal.Width,
            data = iris, cex = .8,
            groups = Species,
            main = "Stereo",
            screen = list(z = 20, x = -70, y = 0),
            par.settings = par.set,
            scales = list(col = "black")),
      split = c(2,1,2,1))


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 11:26 , Processed in 0.035532 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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