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

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

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

                                        Plot and Summarize Trellis Objects
                                         策划和总结网格对象

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

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

The print and plot methods produce a graph from a "trellis" object.  The print method is necessary for automatic plotting.  plot method is essentially an alias, provided for convenience.  The summary method gives a textual summary of the object.  dim and dimnames describe the cross-tabulation induced by conditioning. panel.error is the default handler used when an error occurs while executing the panel function.
print和plot方法产生"trellis"对象图形。 print方法是必要的自动绘制。 plot方法本质上是一个别名,提供了方便。 summary方法,给出了一个对象的文本摘要。 dim和dimnames描述空调引起的交叉制表。 panel.error是使用默认的处理程序发生错误时,同时执行面板功能。


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


## S3 method for class 'trellis'
plot(x, position, split,
      more = FALSE, newpage = TRUE,
      packet.panel = packet.panel.default,
      draw.in = NULL,
      panel.height = lattice.getOption("layout.heights")$panel,
      panel.width = lattice.getOption("layout.widths")$panel,
      save.object = lattice.getOption("save.object"),
      panel.error = lattice.getOption("panel.error"),
      prefix,
      ...)
## S3 method for class 'trellis'
print(x, ...)

## S3 method for class 'trellis'
summary(object, ...)

## S3 method for class 'trellis'
dim(x)
## S3 method for class 'trellis'
dimnames(x)

panel.error(e)




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

参数:x, object
an object of class "trellis"
一个对象类"trellis"


参数:position
a vector of 4 numbers, typically c(xmin, ymin, xmax, ymax) that give the lower-left and upper-right corners of a rectangle in which the Trellis plot of x is to be positioned. The coordinate system for this rectangle is [0-1] in both the x and y directions.  
一个4位数字的向量,通常是c(XMIN,YMIN,XMAX,YMAX),使x的格子图是被定位在矩形的左下角和右上角的角落。这个矩形的坐标系统[0-1]在X和Y方向。


参数:split
a vector of 4 integers, c(x,y,nx,ny) , that says to position the current plot at the x,y position in a regular array of nx by ny plots. (Note: this has origin at top left)  
4个整数,C(X,Y,NX,NY),说定位在X,Y位置在NX的定期纽约图的阵列目前积向量。 (注:在左上角的起源)


参数:more
A logical specifying whether more plots will follow on this page.  
逻辑指定是否有更多的图将按照此页面上。


参数:newpage
A logical specifying whether the plot should be on a new page. This option is specific to lattice, and is useful for including lattice plots in an arbitrary grid viewport (see the details section).  
逻辑指定的图是否应该在新的一页。此选项是特定的晶格,是有用的,包括在任意网格视口(见细节部分)的晶格图。


参数:packet.panel
a function that determines which packet (data subset) is plotted in which panel.  Panels are always drawn in an order such that columns vary the fastest, then rows and then pages. This function determines, given the column, row and page and other relevant information, the packet (if any) which should be used in that panel.  By default, the association is determnined by matching panel order with packet order, which is determined by varying the first conditioning variable the fastest, then the second, and so on.  This association rule is encoded in the default, namely the function packet.panel.default, whose help page details the arguments supplied to whichever function is specified as the packet.panel argument.  
一个函数,确定哪些数据包(数据子集)绘制的面板。面板总是绘制在命令列变化最快,然后行,然后页。此功能决定,鉴于列,行和页和其他有关资料,数据包(如有)应在该面板使用。默认情况下,该协会是由数据包的顺序,确定这是由不同的调节变量是最快的,那么第二等的面板为了配合determnined。该协会在默认编码规则,即函数packet.panel.default,他们的帮助页的详细信息提供为准功能为packet.panel参数指定的参数。


参数:draw.in
An optional (grid) viewport (used as the name argument in downViewport) in which the plot is to be drawn.  If specified, the newpage argument is ignored.  This feature is not well-tested.  
可选(格)视口(namedownViewport参数),其中的图绘制。如果指定newpage参数将被忽略。此功能没有得到很好的测试。


参数:panel.width, panel.height
lists with 2 components, that should be valid x and units arguments to unit() (the data argument cannot be specified currently, but can be considered for addition if needed).  The resulting unit object will be the width/height of each panel in the Lattice plot. These arguments can be used to explicitly control the dimensions of the panel, rather than letting them expand to maximize available space.  Vector widths are allowed, and can specify unequal lengths across rows or columns.  Note that this option should not be used in conjunction with non-default values of the aspect argument in the original high level call (no error will be produced, but the resulting behaviour is undefined).  
2组件的列表,应该是有效的x和units参数unit()(data参数不能被当前指定的,但可以考虑此外,如果需要的话)。由此产生的:unit对象将是每个面板的宽度/高度的格子图。这些参数可以用来显式控制面板的尺寸,而不是让他们扩大可用空间最大化。向量宽度是允许的,并可以指定行或列之间的不平等长度。注意,此选项不应在非默认值,在原有的高级别调用(没有错误,将产生的,但由此产生的行为是未定义)aspect参数一起使用。


参数:save.object
logical, specifying whether the object being printed is to be saved.  The last object thus saved can be subsequently retrieved. This is an experimental feature that should allow access to a panel's data after the plot is done, making it possible to enhance the plot after the fact.  This also allows the user to invoke the update method on the current plot, even if it was not assigned to a variable explicitly.  For more details, see trellis.focus.  
逻辑,指定是否要保存被打印的对象。随后可检索的最后一个对象,从而保存。这是一个实验性的功能,应允许访问的图后,使得它可以增强事实的图后面板的数据。这也允许用户调用在当前的图update方法,即使它没有明确分配给一个变量。有关详细信息,请参阅trellis.focus。


参数:panel.error
a function, or a character string naming a function, that is to be executed when an error occurs during the execution of the panel function.  The error is caught (using tryCatch) and supplied as the only argument to panel.error.  The default behaviour (implemented as the panel.error function) is to print the corresponding error message in the panel and continue.  To stop execution on error, use panel.error = stop.  Normal error recovery and debugging tools are unhelpful when tryCatch is used.  tryCatch can be completely bypassed by setting panel.error to NULL.  
一个函数,或者一个字符串,命名功能,这是面板功能的执行过程中出现错误时,必须执行。被捕获的错误(使用tryCatch)提供panel.error作为唯一的参数。默认行为(作为panel.error功能实现),是在面板打印相应的错误信息并继续。停止执行错误,使用panel.error = stop。正常的错误恢复和调试工具是无益的,当tryCatch使用。 tryCatch可以完全绕过设置panel.error为NULL。


参数:prefix
A character string acting as a prefix identifying the plot of a "trellis" object, primarily used in constructing viewport and grob names, to distinguish similar viewports if a page contains multiple plots.  The default is based on the serial number of the current plot on the current page (specifically, "plot_01", "plot_02", etc.).  If supplied explicitly, this must be a valid R symbol name (briefly, it must start with a letter or a period followed by a letter) and must not contain the grid path separator (currently "::").  
一个字符串,作为确定"trellis"对象主要用于建设视口和GROB名,区分类似的视口,如果一个网页包含多个图,图的前缀。默认是基于当前页面上的电流图序号(特别是"plot_01","plot_02"等)。如果提供明确的,这必须是一个有效的R符号名(简单地说,它必须后跟一个字母一个字母或一个时期的开始),并不得含有电网的路径分隔符(目前"::")。


参数:e
an error condition caught by tryCatch
一个错误条件,抓住tryCatch


参数:...
extra arguments, ignored by the print method.  All arguments to the plot method are passed on to the print method.  
额外的参数,忽略print方法。所有plot方法的参数传递给print方法。


Details

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

This is the default print method for objects of class "trellis", produced by calls to functions like xyplot, bwplot etc. It is usually called automatically when a trellis object is produced. It can also be called explicitly to control plot positioning by means of the arguments split and position.
这是类对象的默认打印方法"trellis",调用功能,如生产xyplot,bwplot等,它通常被称为网格对象时,自动产生。它也可以被称为明确控制手段的论点split和position图定位。

When newpage = FALSE, the current grid viewport is treated as the plotting area, making it possible to embed a Lattice plot inside an arbitrary grid viewport.  The draw.in argument provides an alternative mechanism that may be simpler to use.
当newpage = FALSE,当前电网视口中绘图区处理,使得它可以嵌入任意网格视口内的格子图。 draw.in参数提供了一种替代的机制,可能是简单的使用。

The print method uses the information in x (the object to be printed) to produce a display using the Grid graphics engine. At the heart of the plot is a grid layout, of which the entries of most interest to the user are the ones containing the display panels.
Print方法使用的信息x(要打印的对象)的生产显示,使用电网的图形引擎。在图的核心是网格布局,其中用户最感兴趣的项目的展板。

Unlike in older versions of Lattice (and Grid), the grid display tree is retained after the plot is produced, making it possible to access individual viewport locations and make additions to the plot.  For more details and a lattice level interface to these viewports, see trellis.focus.
与格老版本(和电网),网格显示树被保留的图后,生产,使其能够访问单个视口的位置,并添置图。对于更多的细节和格子级接口,这些视口,看到trellis.focus。


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

Unlike S-PLUS, trying to position a multipage display (using position and/or split) will mess things up.
不像,S-PLUS,试图将自己定位在多显示(使用position和/或split)乱七八糟的东西了。


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


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



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

Lattice, unit, update.trellis, trellis.focus, packet.panel.default
Lattice,unit,update.trellis,trellis.focus,packet.panel.default


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



p11 <- histogram( ~ height | voice.part, data = singer, xlab="Height")
p12 <- densityplot( ~ height | voice.part, data = singer, xlab = "Height")
p2 <- histogram( ~ height, data = singer, xlab = "Height")


## simple positioning by split[#简单的定位由分裂]
print(p11, split=c(1,1,1,2), more=TRUE)
print(p2, split=c(1,2,1,2))

## Combining split and position:[#结合分裂和位置:]
print(p11, position = c(0,0,.75,.75), split=c(1,1,1,2), more=TRUE)
print(p12, position = c(0,0,.75,.75), split=c(1,2,1,2), more=TRUE)
print(p2, position = c(.5,.75,1,1), more=FALSE)

## Using seekViewport[#使用seekViewport]

## repeat same plot, with different polynomial fits in each panel[#重复同样的图,每个小组在不同的多项式拟合]
xyplot(Armed.Forces ~ Year, longley, index.cond = list(rep(1, 6)),
       layout = c(3, 2),
       panel = function(x, y, ...)
       {
           panel.xyplot(x, y, ...)
           fm <- lm(y ~ poly(x, panel.number()))
           llines(x, predict(fm))
       })

## Not run: [#无法运行:]
grid::seekViewport(trellis.vpname("panel", 1, 1))
cat("Click somewhere inside the first panel:\n")
ltext(grid::grid.locator(), lab = "linear")

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

grid::seekViewport(trellis.vpname("panel", 1, 1))
grid::grid.text("linear")

grid::seekViewport(trellis.vpname("panel", 2, 1))
grid::grid.text("quadratic")

grid::seekViewport(trellis.vpname("panel", 3, 1))
grid::grid.text("cubic")

grid::seekViewport(trellis.vpname("panel", 1, 2))
grid::grid.text("degree 4")

grid::seekViewport(trellis.vpname("panel", 2, 2))
grid::grid.text("degree 5")

grid::seekViewport(trellis.vpname("panel", 3, 2))
grid::grid.text("degree 6")

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-23 00:00 , Processed in 0.031517 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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