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

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

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

                                        Default axis annotation utilities
                                         默认轴标注公用事业

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

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

Lattice funtions provide control over how the plot axes are annotated through a common interface.  There are two levels of control.  The xscale.components and yscale.components arguments can be functions that determine tick mark locations and labels given a packet.  For more direct control, the axis argument can be a function that actually draws the axes.  The functions documented here are the defaults for these arguments.  They can additonally be used as components of user written replacements.
莱迪思funtions提供超过图轴是通过一个共同的接口注明如何控制。有两个级别的控制。 xscale.components和yscale.components参数可以是确定刻度的位置,并给出一个包的标签的功能。更直接的控制,axis参数可以是一个函数,实际上绘制轴。这里记录的功能,这些参数的默认值。 additonally他们可以被用来作为用户的书面替代的组成部分。


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


xscale.components.default(lim,
                          packet.number = 0,
                          packet.list = NULL,
                          top = TRUE,
                          ...)
yscale.components.default(lim,
                          packet.number = 0,
                          packet.list = NULL,
                          right = TRUE,
                          ...)
axis.default(side = c("top", "bottom", "left", "right"),
             scales, components, as.table,
             labels = c("default", "yes", "no"),
             ticks = c("default", "yes", "no"),
             ..., prefix)




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

参数:lim
the range of the data in that packet (data subset corresponding to a combination of levels of the conditioning variable).  The range is not necessarily numeric; e.g. for factors, they could be character vectors representing levels, and for the various date-time representations, they could be vectors of length 2 with the corresponding class.  
在这个包中的数据(数据子集相应的调节变量水平的组合)的范围。范围不一定是数字,例如因素,它们可能代表水平的特征向量,并为各种日期时间的交涉,他们可能是相应的类长度为2的向量。


参数:packet.number
which packet (counted according to the packet order, described in print.trellis) is being processed.  In cases where all panels have the same limits, this function is called only once (rather than once for each packet), in which case this argument will have the value 0.  
包(根据数据包的顺序,描述print.trellis)计算正在处理。在所有的面板有相同的限制的情况下,此功能被称为只有一次(而不是一次对每个数据包),在这种情况下,这种说法有值0。


参数:packet.list
list, as long as the number of packets, giving all the actual packets.  Specifically, each component is the list of arguments given to the panel function when and if that packet is drawn in a panel.  (This has not yet been implemented.)  
列表,作为长期的数据包数量,让所有的实际包。具体来说,每一个组件面板功能的时候,如果该数据包是在面板上绘制的参数列表。 (这尚未得到落实。)


参数:top, right
the value of the top and right components of the result, as appropriate.  See below for interpretation.
价值top和right结果的组成部分,在适当的。看到下面的解释。


参数:side
on which side the axis is to be drawn.  The usual partial matching rules apply.   
哪一方要绘制轴。通常部分匹配规则适用。


参数:scales
the appropriate component of the scales argument supplied to the high level function, suitably standardized.  
scales参数适当的组件,提供高水平功能,适当的标准化。


参数:components
list, similar to those produced by xscale.components.default and yscale.components.default.   
列表中,类似xscale.components.default和yscale.components.default生产。


参数:as.table
the as.table argument in the high level function.   
as.table参数,在高级别功能。


参数:labels
whether labels are to be drawn.  By default, the rules determined by scales are used.   
标签是否要绘制。默认情况下,scales确定的规则使用。


参数:ticks
whether labels are to be drawn.  By default, the rules determined by scales are used.   
标签是否要绘制。默认情况下,scales确定的规则使用。


参数:...
many other arguments may be supplied, and are passed on to other internal functions.  
可以提供许多其他参数,并传递给其他内部功能。


参数:prefix
A character string identifying the plot being drawn (see print.trellis).  Used to retrieve location of current panel in the overall layout, so that axes can be drawn appropriately.  
正在制定一个字符串,确定图(见print.trellis)。用于检索当前面板的位置,在整体布局,因此,可以得出适当的轴。


Details

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

These functions are part of a new API introduced in lattice 0.14 to provide the user more control over how axis annotation is done.  While the API has been designed in anticipation of use that was previously unsupported, the implementation has initially focused on reproducing existing capabilities, rather than test new features.  At the time of writing, several features are unimplemented.  If you require them, please contact the maintainer.
这些功能是在引入晶格0.14提供用户更多的控制轴注解如何做一个新的API的一部分。虽然已在预期使用以前不受支持的API设计,实施,最初专注于音响现有的能力,而不是新功能测试。在写作时,未使用的几个特点。如果您需要,请联系维护者。


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

xscale.components.default and yscale.components.default return a list of the form suitable as the components argument of axis.default.  Valid components in the return value of xscale.components.default are:
xscale.components.default和yscale.components.default返回一个列表的形式适合作为componentsaxis.default的论据。在的xscale.components.default回报价值的有效组成部分:


参数:<code>num.limit</code>
A numeric limit for the box.  
一个数字框限制。


参数:<code>bottom</code>
A list with two elements, ticks and labels.  ticks must be a list with components at and tck which give the location and lengths of tick marks.  tck can be a vector, and will be recycled to be as long as at.  labels must be a list with components at, labels, and check.overlap.  at and labels give the location and labels of the tick labels; this is usually the same as the location of the ticks, but is not required to be so.  check.overlap is a logical flag indicating whether overlapping of labels should be avoided by omitting some of the labels while rendering.   
两个元素,ticks和labels名单。 ticks必须是一个与组件列表at和tck给刻度的位置和长度。 tck可以是一个向量,将被回收作为at长。 labels必须是一个组件列表at,labels和check.overlap。 at和labels给的位置和刻度标记的标签,这通常是为刻度线位置相同,但不需要如此。 check.overlap是一个逻辑标志,指示是否重叠的标签应避免通过省略一些标签,而渲染。


参数:<code>top</code>
This can be a logical flag; if TRUE, top is treated as being the same as bottom; if FALSE, axis annotation for the top axis is omitted. Alternatively, top can be a list like bottom.  
这可以是一个逻辑标志;如果TRUE,top治疗是一样的bottom;如果FALSE为顶轴,轴注释被忽略。另外,top可以像bottom名单。

Valid components in the return value of yscale.components.default are left and right. Their interpretations are analogous to (respectively) the bottom and top components described above.
在的yscale.components.default回报价值的有效组成部分是left和right。他们的解释是类似(分别)bottom和top组件如上所述。


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


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



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

Lattice, xyplot,  print.trellis
Lattice,xyplot,print.trellis


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



str(xscale.components.default(c(0, 1)))

set.seed(36872)
rln <- rlnorm(100)

densityplot(rln,
            scales = list(x = list(log = 2), alternating = 3),
            xlab = "Simulated lognormal variates",
            xscale.components = function(...) {
                ans <- xscale.components.default(...)
                ans$top <- ans$bottom
                ans$bottom$labels$labels <- parse(text = ans$bottom$labels$labels)
                ans$top$labels$labels <-
                    if (require(MASS))
                        fractions(2^(ans$top$labels$at))
                    else
                        2^(ans$top$labels$at)
                ans
            })


## Direct use of axis to show two temperature scales (Celcius and[#直接使用的轴显示两个温标(摄氏和]
## Fahrenheit).  This does not work for multi-row plots, and doesn't[#华氏度)。这不起作用,多行图,并没有]
## do automatic allocation of space[#做自动分配空间。]


F2C <- function(f) 5 * (f - 32) / 9
C2F <- function(c) 32 + 9 * c / 5

axis.CF <-
    function(side, ...)
{
    ylim <- current.panel.limits()$ylim
    switch(side,
           left = {
               prettyF <- pretty(ylim)
               labF <- parse(text = sprintf("%s ~ degree * F", prettyF))
               panel.axis(side = side, outside = TRUE,
                          at = prettyF, labels = labF)
           },
           right = {
               prettyC <- pretty(F2C(ylim))
               labC <- parse(text = sprintf("%s ~ degree * C", prettyC))
               panel.axis(side = side, outside = TRUE,
                          at = C2F(prettyC), labels = labC)
           },
           axis.default(side = side, ...))
}

xyplot(nhtemp ~ time(nhtemp), aspect = "xy", type = "o",
       scales = list(y = list(alternating = 3)),
       axis = axis.CF, xlab = "Year", ylab = "Temperature",
       main = "Yearly temperature in New Haven, CT")

## version using yscale.components[#版本使用yscale.components]

yscale.components.CF <-
    function(...)
{
    ans <- yscale.components.default(...)
    ans$right <- ans$left
    ans$left$labels$labels <-
        parse(text = sprintf("%s ~ degree * F", ans$left$labels$at))
    prettyC <- pretty(F2C(ans$num.limit))
    ans$right$ticks$at <- C2F(prettyC)
    ans$right$labels$at <- C2F(prettyC)
    ans$right$labels$labels <-
        parse(text = sprintf("%s ~ degree * C", prettyC))
    ans
}
      

xyplot(nhtemp ~ time(nhtemp), aspect = "xy", type = "o",
       scales = list(y = list(alternating = 3)),
       yscale.components = yscale.components.CF,
       xlab = "Year", ylab = "Temperature",
       main = "Yearly temperature in New Haven, CT")



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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 05:00 , Processed in 0.026783 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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