panel.functions(lattice)
panel.functions()所属R语言包:lattice
Useful Panel Function Components
有用的面板功能部件
译者:生物统计家园网 机器人LoveR
描述----------Description----------
These are predefined panel functions available in lattice for use in constructing new panel functions (often on-the-fly).
这些预定义的面板功能,可用于兴建新的面板功能(通常是上飞)使用晶格。
用法----------Usage----------
panel.abline(a = NULL, b = 0,
h = NULL, v = NULL,
reg = NULL, coef = NULL,
col, col.line, lty, lwd, alpha, type,
...,
reference = FALSE,
identifier = "abline")
panel.refline(...)
panel.curve(expr, from, to, n = 101,
curve.type = "l",
col, lty, lwd, type,
...,
identifier = "curve")
panel.rug(x = NULL, y = NULL,
regular = TRUE,
start = if (regular) 0 else 0.97,
end = if (regular) 0.03 else 1,
x.units = rep("npc", 2),
y.units = rep("npc", 2),
col, col.line, lty, lwd, alpha,
...,
identifier = "rug")
panel.average(x, y, fun = mean, horizontal = TRUE,
lwd, lty, col, col.line, type,
...,
identifier = "linejoin")
panel.linejoin(x, y, fun = mean, horizontal = TRUE,
lwd, lty, col, col.line, type,
...,
identifier = "linejoin")
panel.fill(col, border, ..., identifier = "fill")
panel.grid(h=3, v=3, col, col.line, lty, lwd, x, y, ..., identifier = "grid")
panel.lmline(x, y, ..., identifier = "lmline")
panel.mathdensity(dmath = dnorm, args = list(mean=0, sd=1),
n = 50, col, col.line, lwd, lty, type,
..., identifier = "mathdensity")
参数----------Arguments----------
参数:x, y
Variables defining the contents of the panel. In panel.grid these are optional and are used only to choose an appropriate method of pretty.
变量定义面板的内容。在panel.grid这些都是可选的,只用来选择适当的方法pretty。
参数:a, b
Coefficients of the line to be added by panel.abline. a can be a vector of length 2, representing the coefficients of the line to be added, in which case b should be missing. a can also be an appropriate "regression" object, i.e., an object which has a coef method that returns a length 2 numeric vector. The corresponding line will be plotted. The reg argument overrides a if specified.
要添加行系数由panel.abline。 a可以是一个长度为2的向量,代表该行的系数,以复加,在这种情况下,b应失踪。 a也可以是一个合适的回归的对象,即一个对象,它有coef方法返回一个长度为2的数值向量。将绘制相应的行。 reg参数覆盖a如果指定。
参数:coef
Coefficients of the line to be added as a vector of length 2.
要添加的行的系数长度为2的向量。
参数:reg
A (linear) regression object, with a coef method that gives the coefficints of the corresponding regression line.
(线性)回归对象,coef方法,给出了相应的回归线coefficints。
参数:h, v
For panel.abline, these are numeric vectors giving locations respectively of horizontal and vertical lines to be added to the plot, in native coordinates. For panel.grid, these usually specify the number of horizontal and vertical reference lines to be added to the plot. Alternatively, they can be negative numbers. h=-1 and v=-1 are intended to make the grids aligned with the axis labels. This doesn't always work; all that actually happens is that the locations are chosen using pretty, which is also how the label positions are chosen in the most common cases (but not for factor variables, for instance). h and v can be negative numbers other than -1, in which case -h and -v (as appropriate) is supplied as the n argument to pretty. If x and/or y are specified in panel.grid, they will be used to select an appropriate method for pretty. This is particularly useful while plotting date-time objects.
panel.abline,这些都是给位置分别被添加到的图,在本地坐标,水平和垂直线的数字向量。对于panel.grid,这些通常指定水平和垂直参考线的数量,被添加到图。另外,也可以是负数。 h=-1和v=-1目的是为了使轴标签对齐网格。这并不总是工作;所有实际发生的位置选择使用pretty,这也是标签位置是最常见的情况下如何选择(但不为因子变量,例如)。 h和v可以比-1其他的负数,在这种情况下,-h和-v(如适用)提供的n pretty的参数。如果x和/或ypanel.grid,他们将用来选择适当的方法pretty指定。同时绘制日期时间对象,这是特别有用。
参数:reference
A logical flag determining whether the default graphical parameters for panel.abline should be taken from the “reference.line” parameter settings. The default is to take them from the “add.line” settings. The panel.refline function is a wrapper around panel.abline that calls it with reference = TRUE.
逻辑标志确定是否为panel.abline应从“reference.line的”参数设置采取了默认的图形参数。默认是采取从“add.line的”设置。 panel.refline功能是围绕包装panel.abline调用reference = TRUE。
参数:expr
An expression considered as a function of x, or a function, to be plotted as a curve.
被视为x,或一个函数的函数表达式,绘制曲线。
参数:n
The number of points to use for drawing the curve.
用于绘制曲线的点数。
参数:from, to
optional lower and upper x-limits of curve. If missing, limits of current panel are used
可选的上下曲线x限制。如果失踪,目前面板的使用限制
参数:curve.type
Type of curve ("p" for points, etc), passed to llines
曲线型("p"点等),传递llines的
参数:regular
A logical flag indicating whether the "rug" is to be drawn on the "regular" side (left / bottom) or not (right / top).
一个逻辑标志,指示是否是要在“常规”(左/底部)或(右/顶)绘制的“地毯”。
参数:start, end
endpoints of rug segments, in normalized parent coordinates (between 0 and 1). Defaults depend on value of regular, and cover 3% of the panel width and height.
端点的地毯部分归父坐标,(0和1之间)。默认值取决于值regular,并覆盖面板的宽度和高度的3%。
参数:x.units, y.units
Character vectors, replicated to be of length two. Specifies the (grid) units associated with start and end above. x.units and y.units are for the rug on the x-axis and y-axis respectively (and thus are associated with start and end values on the y and x scales respectively).
特征向量,复制到长度为二。指定(格)start和end以上的单位。 x.units和y.units地毯上的X轴和Y轴分别为(从而start和endy和x的尺度分别值)。
参数:col, col.line, lty, lwd, alpha, border
Graphical parameters.
图形参数。
参数:type
Usually ignored by the panel functions documented here; the argument is present only to make sure an explicitly specified type argument (perhaps meant for another function) does not affect the display.
这里记录的面板功能通常被忽略的说法是目前唯一以确保明确指定type参数(也许是另一个函数的意思),不影响显示。
参数:fun
The function that will be applied to the subset of x values (or y if horizontal is FALSE) determined by the unique values of y (x).
x值(或y如果horizontal是FALSE)y(独特的价值观决定的子集将被应用到的功能X>)。
参数:horizontal
A logical flag. If FALSE, the plot is "transposed" in the sense that the roles of x and y are switched; x is now the "factor". Interpretation of other arguments change accordingly. See documentation of bwplot for a fuller explanation.
一个逻辑标志。如果FALSE,该图“换位”在这个意义上的角色x和y切换;x现在是因素。其他参数的解释发生相应的变化。为更全面的解释,请参阅文件bwplot。
参数:dmath
A vectorized function that produces density values given a numeric vector named x, e.g., dnorm.
一个矢量函数产生定名为x,如数字向量,dnorm密度值。
参数:args
A list giving additional arguments to be passed to dmath.
给予额外的参数列表,可以通过dmath。
参数:...
Further arguments, typically graphical parameters, passed on to other low-level functions as appropriate. Color can usually be specified by col, col.line, and col.symbol, the last two overriding the first for lines and points respectively.
进一步的论据,通常图形的参数,通过适当的其他低级别的功能。颜色通常可以指定col,col.line,col.symbol,最后两个第一,分别覆盖线和点。
参数:identifier
A character string that is prepended to the names of grobs that are created by this panel function.
一个字符串,前面的名称,由本面板功能创建的grobs。
Details
详情----------Details----------
panel.abline adds a line of the form y = a + b * x, or vertical and/or horizontal lines. Graphical parameters are obtained from the “add.line” settings by default. panel.refline is similar, but uses the “reference.line” settings for the defaults.
panel.abliney = a + b * x,或垂直和/或水平线条的形式增加了线。默认情况下,获得的“add.line的”设置图形参数。 panel.refline是相似的,但使用默认“reference.line的”设置。
panel.grid draws a reference grid.
panel.grid提请参考网格。
panel.curve adds a curve, similar to what curve does with add = TRUE. Graphical parameters for the curve are obtained from the “add.line” setting.
panel.curve添加一个曲线,类似于curve与add = TRUE。曲线的图形参数得到从“add.line的”设置。
panel.average treats one of x and y as a factor (according to the value of horizontal), calculates fun applied to the subsets of the other variable determined by each unique value of the factor, and joins them by a line. Can be used in conjunction with panel.xyplot, and more commonly with panel.superpose to produce interaction plots.
panel.average对待一个x和y作为一个因素(根据价值horizontal),计算fun确定的其他变量的子集每个因子的独特价值,并加入一行。可以使用panel.xyplot,更常见的panel.superpose产生互动图结合。
panel.linejoin is an alias for panel.average. It is retained for back-compatibility, and may go away in future.
panel.linejoin是panel.average别名。它保留向后兼容性,可能会在未来走。
panel.mathdensity plots a (usually theoretical) probability density function. This can be useful in conjunction with histogram and densityplot to visually assess goodness of fit (note, however, that qqmath is more suitable for this).
panel.mathdensity图(通常是理论值)的概率密度函数。这可能是有用的histogram和densityplot视觉评估拟合的结合(但是请注意,qqmath这更适合)。
panel.rug adds a rug representation of the (marginal) data to the panel, much like rug.
panel.rug增加了(边际)的面板数据,很像rug地毯的代表性。
panel.lmline(x, y) is equivalent to panel.abline(lm(y ~ x)).
panel.lmline(x, y)相当于panel.abline(lm(y ~ x))的。
作者(S)----------Author(s)----------
Deepayan Sarkar <a href="mailtoeepayan.Sarkar@R-project.org">Deepayan.Sarkar@R-project.org</a>
参见----------See Also----------
Lattice, panel.axis, panel.identify identify, trellis.par.set.
格,panel.axis,panel.identifyidentify,trellis.par.set。
举例----------Examples----------
## Interaction Plot[#交互作用图]
bwplot(yield ~ site, barley, groups = year,
panel = function(x, y, groups, subscripts, ...) {
panel.grid(h = -1, v = 0)
panel.stripplot(x, y, ..., jitter.data = TRUE,
groups = groups, subscripts = subscripts)
panel.superpose(x, y, ..., panel.groups = panel.average,
groups = groups, subscripts = subscripts)
},
auto.key =
list(points = FALSE, lines = TRUE, columns = 2))
## Superposing a fitted normal density on a Histogram[#叠加直方图拟合正常密度]
histogram( ~ height | voice.part, data = singer, layout = c(2, 4),
type = "density", border = "transparent", col.line = "grey60",
xlab = "Height (inches)",
ylab = "Density Histogram\n with Normal Fit",
panel = function(x, ...) {
panel.histogram(x, ...)
panel.mathdensity(dmath = dnorm,
args = list(mean=mean(x),sd=sd(x)), ...)
} )
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|