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

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

[复制链接]
发表于 2012-2-17 10:27:08 | 显示全部楼层 |阅读模式
levelplot(lattice)
levelplot()所属R语言包:lattice

                                        Level plots and contour plots
                                         等级图和等高线图

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

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

Draws false color level plots and contour plots.
绘制假彩色图和等高线图。


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


levelplot(x, data, ...)
contourplot(x, data, ...)

## S3 method for class 'formula'[类formula的方法]
levelplot(x,
          data,
          allow.multiple = is.null(groups) || outer,
          outer = TRUE,
          aspect = "fill",
          panel = if (useRaster) lattice.getOption("panel.levelplot.raster")
                  else lattice.getOption("panel.levelplot"),
          prepanel = NULL,
          scales = list(),
          strip = TRUE,
          groups = NULL,
          xlab,
          xlim,
          ylab,
          ylim,
          at,
          cuts = 15,
          pretty = FALSE,
          region = TRUE,
          drop.unused.levels =
              lattice.getOption("drop.unused.levels"),
          ...,
          useRaster = FALSE,
          lattice.options = NULL,
          default.scales = list(),
          default.prepanel =
              lattice.getOption("prepanel.default.levelplot"),
          colorkey = region,
          col.regions,
          alpha.regions,
          subset = TRUE)

## S3 method for class 'formula'[类formula的方法]
contourplot(x,
            data,
            panel = lattice.getOption("panel.contourplot"),
            default.prepanel =
                lattice.getOption("prepanel.default.contourplot"),
            cuts = 7,
            labels = TRUE,
            contour = TRUE,
            pretty = TRUE,
            region = FALSE,
            ...)

## S3 method for class 'table'
levelplot(x, data = NULL, aspect = "iso", ..., xlim, ylim)

## S3 method for class 'table'
contourplot(x, data = NULL, aspect = "iso", ..., xlim, ylim)

## S3 method for class 'matrix'
levelplot(x, data = NULL, aspect = "iso",
          ..., xlim, ylim,
          row.values = seq_len(nrow(x)),
          column.values = seq_len(ncol(x)))

## S3 method for class 'matrix'
contourplot(x, data = NULL, aspect = "iso",
            ..., xlim, ylim,
            row.values = seq_len(nrow(x)),
            column.values = seq_len(ncol(x)))


## S3 method for class 'array'
levelplot(x, data = NULL, ...)

## S3 method for class 'array'
contourplot(x, data = NULL, ...)





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

参数:x
for the formula method, a formula of the form z ~ x * y       | g1 * g2 * ..., where z is a numeric response, and x, y are numeric values evaluated on a rectangular grid.  g1, g2, ... are optional conditional variables, and must be either factors or shingles if present.  Calculations are based on the assumption that all x and y values are evaluated on a grid (defined by their unique values). The function will not return an error if this is not true, but the display might not be meaningful.  However, the x and y values need not be equally spaced.  Both levelplot and wireframe have methods for matrix, array, and table 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 filled.contour and image.  For higher-dimensional arrays and tables, further dimensions are used as conditioning variables.  Note that the dimnames may be duplicated; this is handled by calling make.unique to make the names unique (although the original labels are used for the x- and y-axes).  
为formula方法,公式的形式z ~ x * y       | g1 * g2 * ...,z是一个数字的反应,x,y数值是一个长方形的评估格。 g1, g2, ...是可选的条件变量,必须是如果存在任何因素或带状疱疹。计算是基于假设所有的X和Y值是一个网格(其独特的价值定义)评估。该函数不会返回一个错误,如果这是不正确的,但显示未必是有意义的。然而,X和Y值需要不能等距离。既levelplot和wireframe有方法matrix,array,table对象,在这种情况下x提供z矢量描述以上,而它的行和列x和y向量分别解释。这是类似的形式使用filled.contour和image。对于高维数组和表,进一步尺寸被用来作为调节变量。注意dimnames可能被复制;这是处理调用make.unique使独特的名字(虽然原标签使用的X和Y轴)。


参数: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.  Usually ignored with a warning in other cases.  
formula方法,一个可选的数据框在公式中的变量(以及groups和subset,如果有的话)进行评估。通常被忽略,在其他情况下发出警告。


参数: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)分别必须有相同的长度。默认情况下,行数和列数。


参数:panel
panel function used to create the display, as described in xyplot  
面板功能用于创建显示,xyplot


参数:aspect
For the matrix methods, the default aspect ratio is chosen to make each cell square.  The usual default is aspect="fill", as described in xyplot.  
matrix方法,默认宽高比选择,使每个单元平方米。通常默认是aspect="fill",xyplot。


参数:at
A numeric vector giving breakpoints along the range of z. Contours (if any) will be drawn at these heights, and the regions in between would be colored using col.regions.  In the latter case, values outside the range of at will not be drawn at all.  This serves as a way to limit the range of the data shown, similar to what a zlim argument might have been used for.  However, this also means that when supplying at explicitly, one has to be careful to include values outside the range of z to ensure that all the data are shown.  
给予一个数值向量断点沿z的范围内。轮廓(如有)将在这些高度,颜色之间的区域将使用col.regions。在后一种情况,外at范围的值不会得出所有。这作为一种方式,以限制所显示的数据,类似什么zlim参数可能已被用于范围。然而,这也意味着,供电时at明确,一是要小心包括z,以确保所有的数据都显示范围以外的值。


参数:col.regions
color vector to be used if regions is TRUE. The general idea is that this should be a color vector of moderately large length (longer than the number of regions. By default this is 100). It is expected that this vector would be gradually varying in color (so that nearby colors would be similar). When the colors are actually chosen, they are chosen to be equally spaced along this vector.  When there are more regions than colors in col.regions, the colors are recycled.  The actual color assignment is performed by level.colors, which is documented separately.  
要使用的颜色矢量区域为TRUE。总的想法是,这应该是一个中等长度大,颜色矢量(长于一些区域。默认情况下,这是100)。据预计,这个向量将逐渐不同的颜色(使附近的颜色会类似)。当颜色实际上是选择,他们选择同样要沿着这条向量间隔。当有更多的区域比col.regions颜色,颜色都回收。实际的颜色分配level.colors,分别记录。


参数:alpha.regions
numeric, specifying alpha transparency (works only on some devices)  
数字,指定Alpha透明度(仅适用于某些设备)


参数:colorkey
logical specifying whether a color key is to be drawn alongside the plot, or a list describing the color key. The list may contain the following components:     
逻辑指定的颜色是否关键是要制定旁边的图,或描述颜色键列表。该列表可能包含以下组件:

space: location of the colorkey, can be one of "left", "right", "top" and "bottom".  Defaults to "right".   
space:colorkey的位置,可以是"left","right","top"和"bottom"。 "right"默认。

x, y: location, currently unused   
x,y:位置,目前未使用

col: A color ramp specification, as in the col.regions argument in level.colors   
在col参数col.regions level.colors:色的坡道规范,

at: numeric vector specifying where the colors change. must be of length 1 more than the col vector.   
at:数字矢量指定颜色改变。必须是长度为1比山坳向量。

labels: a character vector for labelling the at values, or more commonly, a list describing characteristics of the labels.  This list may include components labels, at, cex, col, rot, font, fontface and fontfamily.   
labels:标签at值的特征向量,或更常见的列表描述标签的特点。这份列表可能包括组件labels,at,cex,col,rot,font,fontface和<X >

tick.number: approximate number of ticks.   
tick.number:刻度线近似的数量。

corner: interacts with x, y; unimplemented   
corner:X,Y相互作用;未实现

width: width of the key   
width:宽度的关键

height: length of key w.r.t side of plot.   
height的图关键w.r.t侧的长度。

raster: Logical flag indicating whether the colorkey should be rendered as a raster image using grid.raster.  See also panel.levelplot.raster.   
raster:逻辑的标志,表明了colorkey是否应呈现栅格使用grid.raster的形象的。还可以看panel.levelplot.raster。

interpolate: Logical flag, passed to rasterGrob when raster=TRUE.   
interpolate:逻辑标志,传递rasterGrob时raster=TRUE的。

axis.line: A list giving graphical parameters for the color key boundary and tick marks.  Defaults to trellis.par.get("axis.line").   
axis.line:给颜色键边界和刻度的图形参数列表。 trellis.par.get("axis.line")默认。

axis.text: A list giving graphical parameters for the tick mark labels on the color key.  Defaults to trellis.par.get("axis.text").      
axis.text:给刻度标签上的颜色键的图形参数列表。 trellis.par.get("axis.text")默认。


参数:contour
logical, whether to draw contour lines.  
逻辑,无论是绘制等高线。


参数:cuts
number of levels the range of z would be divided into  
级别数z范围将分为


参数:labels
typically a logical indicating whether contour lines should be labelled, but other possibilities for more sophisticated control exists.  Details are documented in the help page for panel.levelplot, to which this argument is passed on unchanged.  That help page also documents the label.style argument, which affects how the labels are rendered.  
通常是一个等高线是否应标示,但存在其他的可能性更精密的控制逻辑。详细记录在帮助页面panel.levelplot,这种说法是不变通过。同时,帮助页面记录label.style参数,从而影响如何呈现的标签。


参数:pretty
logical, whether to use pretty cut locations and labels  
逻辑,是否使用漂亮切的位置和标签


参数:region
A logical flag, indicating whether regions between contour lines should be filled as in a level plot.  
一个逻辑标志,指示是否应在平积填补轮廓线之间的区域。

these arguments are described in the help page for xyplot.  
这些参数在帮助页面描述xyplot。


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


参数:...
Further arguments may be supplied.  Some are processed by levelplot or contourplot, and those that are unrecognized are passed on to the panel function.  
可提供进一步的论据。一些levelplot或contourplot处理,那些是无法识别通过面板功能。


参数:useRaster
A logical flag indicating whether raster representations should be used, both for the false color image and the color key (if present). Effectively, setting this to TRUE changes the default panel function from panel.levelplot to panel.levelplot.raster, and sets the default value of colorkey$raster to TRUE.  Note that panel.levelplot.raster provides only a subset of the features of panel.levelplot, but setting useRaster=TRUE will not check whether any of the additional features have been requested.  Not all devices support raster images.  For devices that appear to lack support, useRaster=TRUE will be ignored with a warning.  
一个逻辑标志,表明栅格表示是否应该使用假彩色图像和颜色键(如果存在)。有效,设置TRUE改变panel.levelplot默认panel.levelplot.raster面板功能,并设置默认值colorkey$rasterTRUE。注意panel.levelplot.raster只提供了panel.levelplot功能的子集,但设置useRaster=TRUE不会检查是否有任何附加功能已要求。并非所有的设备都支持光栅图像。似乎缺乏支持的设备,useRaster=TRUE将被忽略警告。


Details

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

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

Other useful arguments are mentioned in the help page for the default panel function panel.levelplot (these are formally arguments to the panel function, but can be specified in the high level calls directly).
其他有用的参数是默认的面板功能panel.levelplot(这是正式的参数的面板功能,但可以在指定的高级别直接调用)中提到的帮助页。


值----------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方法(通常称为默认情况下),将适当的绘图设备上绘制它的组成部分。


作者(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----------

xyplot, Lattice, panel.levelplot
xyplot,Lattice,panel.levelplot


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


x <- seq(pi/4, 5 * pi, length.out = 100)
y <- seq(pi/4, 5 * pi, length.out = 100)
r <- as.vector(sqrt(outer(x^2, y^2, "+")))
grid <- expand.grid(x=x, y=y)
grid$z <- cos(r^2) * exp(-r/(pi^3))
levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
          ylab="", main="Weird Function", sub="with log scales",
          colorkey = FALSE, region = TRUE)


#S-PLUS example[,S-PLUS例子]
require(stats)
attach(environmental)
ozo.m <- loess((ozone^(1/3)) ~ wind * temperature * radiation,
       parametric = c("radiation", "wind"), span = 1, degree = 2)
w.marginal <- seq(min(wind), max(wind), length.out = 50)
t.marginal <- seq(min(temperature), max(temperature), length.out = 50)
r.marginal <- seq(min(radiation), max(radiation), length.out = 4)
wtr.marginal <- list(wind = w.marginal, temperature = t.marginal,
        radiation = r.marginal)
grid <- expand.grid(wtr.marginal)
grid[, "fit"] <- c(predict(ozo.m, grid))
contourplot(fit ~ wind * temperature | radiation, data = grid,
            cuts = 10, region = TRUE,
            xlab = "Wind Speed (mph)",
            ylab = "Temperature (F)",
            main = "Cube Root Ozone (cube root ppb)")
detach()

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-22 21:39 , Processed in 0.023785 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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