加入收藏
大学数学, 研究生数学,大学数学资料下载,免费 大学数学课件,研究生数学课件,免费下载
R语言- coplot () 函数 (中文帮助)
2016-01-06 00:12:17

coplot {graphics} 

[转载请注明出处,胡桃木屋 mathapply.cn ”R语言中文帮助“工作室译]


Conditioning Plots

条件图


Description(描述)

    This function produces two variants of the conditioning plots discussed in the reference below.
    该函数用于生成在下面的参考文献中讨论的两个变量的条件图。


Usage(用法)

coplot(formula, data, given.values, panel = points, rows, columns,
       show.given = TRUE, col = par("fg"), pch = par("pch"),
       bar.bg = c(num = gray(0.8), fac = gray(0.95)),
       xlab = c(x.name, paste("Given :", a.name)),
       ylab = c(y.name, paste("Given :", b.name)),
       subscripts = FALSE,
       axlabels = function(f) abbreviate(levels(f)),
       number = 6, overlap = 0.5, xlim, ylim, ...)
co.intervals(x, number = 6, overlap = 0.5)


Arguments(参数)
formula  

     a formula describing the form of conditioning plot. A formula of the form y ~ x | a indicates that plots of y versus x should be produced conditional on the variable a. A formula of the form y ~ x| a * b indicates that plots of y versus x should be produced conditional on the two variables a and b.
    一个描述条件图的公式。形如y~x | a 的表达形式,表示在条件变量a的前提下,y与x相关的图形。形如y~x | a*b 表示在两个变量a和b的条件下,y与x的相关图形。

    All three or four variables may be either numeric or factors. When x or y are factors, the result is almost as if as.numeric() was applied, whereas for factor a or b, the conditioning (and its graphics if show.given is true) are adapted.

    所有三个或四个变量可能是数值或因子。当x或y是因子时,几乎所有结果都如同使用了as.numeric(),无论对因子a或b,(如果show.given为真)条件作用(和它的图形)都发生了变化。


data

    a data frame containing values for any variables in the formula. By default the environment where coplot was called from is used.

    一个数据框,包含了任何在formula参数中的变量值。默认情况下,coplot从被使用的环境中被调用。


given.values  

    a value or list of two values which determine how the conditioning on a and b is to take place.
    一个值或两个值的列表,它决定了如何在a和b上的条件是如何发生的。

    When there is no b (i.e., conditioning only on a), usually this is a matrix with two columns each row of which gives an interval, to be conditioned on, but is can also be a single vector of numbers or a set of factor levels (if the variable being conditioned on is a factor). In this case (no b), the result of co.intervals can be used directly as given.values argument.
   当没有b(即,条件只有a)时, 通常这个参数是一个每行有两列的矩阵,它给定一个区间,用于约束。 但是该参数也可以是单个的数值向量或一组因子水平(如果变量被一个因子所约束)。 在这种情况下(没b条件), co.intervals的结果可以直接用于given.values的参数。

panel  

    a function(x, y, col, pch, ...) which gives the action to be carried out in each panel of the display. The default is points.
    一个函数(x,y,col,pch,...),它给定了在每一个显示面板中执行的命令。默认是画点。

rows  

    the panels of the plot are laid out in a rows by columns array. rows gives the number of rows in the array.
    图形面板是按行排列的,通过列的array.rows给定阵列中的行数。

columns  

    the number of columns in the panel layout array.
    在面板上布局阵列的列数。

show.given  

    logical (possibly of length 2 for 2 conditioning variables): should conditioning plots be shown for the corresponding conditioning variables (default TRUE).
    逻辑值(对2个条件变量长度可能为2):对相应的条件变量(默认为TRUE)条件图是否显示。

col  

    a vector of colors to be used to plot the points. If too short, the values are recycled.
    一个颜色向量,用于绘制点。如果太短,值会自动循环补齐。

pch  

    a vector of plotting symbols or characters. If too short, the values are recycled.
     一个用于绘制的符号向量或字符向量。如果太短,其值将自动补齐。

bar.bg  

    a named vector with components "num" and "fac" giving the background colors for the (shingle) bars, for numeric and factor conditioning variables respectively.
    一个由"num"和"fac"组成的命名向量,它是分别为(瓦顶)条形、数值和因子条件变量指定背景颜色。

xlab  

    character; labels to use for the x axis and the first conditioning variable. If only one label is given, it is used for the x axis and the default label is used for the conditioning variable.
    字符; 用于x轴和第一个条件变量的标签。如果仅仅给定只有一个标签, 它用于x轴,条件变量使用默认的标签。

ylab  

    character; labels to use for the y axis and any second conditioning variable.
    字符; 用于y轴和第二条件变量的标签。

subscripts  

    logical: if true the panel function is given an additional (third) argument subscripts giving the subscripts of the data passed to that panel.
    逻辑型;如果为真,一个附加(第三个)参数下标被赋予panel函数,给定的数据下标传给该panel函数。

axlabels  

    function for creating axis (tick) labels when x or y are factors.
    当x或y是因子变量时,该函数用于创建刻度标签。

number  

    integer; the number of conditioning intervals, for a and b, possibly of length 2. It is only used if the corresponding conditioning variable is not a factor.
    整数; 条件区间的数量,用于a和b, 可能长度为2。 它仅仅用于条件变量不是一个因子的情况。

overlap  

    numeric < 1; the fraction of overlap of the conditioning variables, possibly of length 2 for x and y direction. When overlap < 0, there will be gaps between the data slices.
    数值 <1; 用于x和y方向的条件变量重叠的分数,长度可能为2。当overlap<0时,在数据切片之间会有差异。

xlim  

    the range for the x axis.
    x轴的范围。

ylim  

    the range for the y axis.
    y轴的范围。

...  

    additional arguments to the panel function.
    用于面板函数的额外参数。

x  

    a numeric vector.
    一个数值向量。


Details(详细描述)

    In the case of a single conditioning variable a, when both rows and columns are unspecified, a ‘close to square’ layout is chosen with columns >= rows.
   在单个条件变量的情况下,当两行和所以列都没有指定情况时,会选择一个‘近似正方形’的布局,且columns>=rows。

    In the case of multiple rows, the order of the panel plots is from the bottom and from the left (corresponding to increasing a, typically).
    在多行的情况下, 绘制画板的顺序是从左下开始的(通常相应的增加)。

    A panel function should not attempt to start a new plot, but just plot within a given coordinate system: thus plot and boxplot are not panel functions.
    一个画板函数应该不能打开一个新的图形,只是仅仅在给定的坐标系绘制:因而plot和boxplot没有画板函数。

    The rendering of arguments xlab and ylab is not controlled by par arguments cex.lab and font.lab even though they are plotted by mtext rather than title.
    渲染参数xlab和ylab不会受par参数cex.lab和font.lab的控制,即使它们通过mtext绘制而不是title。


 Value(返回值)


    co.intervals(., number, .) returns a (number x 2) matrix, say ci, where ci[k,] is the range of x values for the k-th interval.
    co.intervals(.,number,.)返回一个(number x 2) 矩阵,称为ci, 这里 ci[k,]是第k个区间的x值。


References(参考文献)

Chambers, J. M. (1992) Data for models. Chapter 3 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.

Cleveland, W. S. (1993) Visualizing Data. New Jersey: Summit Press.


See Also(另见)

pairs, panel.smooth, points.


Examples(示例)

## Tonga Trench Earthquakes
coplot(lat ~ long | depth, data = quakes)
given.depth <- co.intervals(quakes$depth, number = 4, overlap = .1)
coplot(lat ~ long | depth, data = quakes, given.v = given.depth, rows = 1)

## Conditioning on 2 variables:
ll.dm <- lat ~ long | depth * mag
coplot(ll.dm, data = quakes)
coplot(ll.dm, data = quakes, number = c(4, 7), show.given = c(TRUE, FALSE))
coplot(ll.dm, data = quakes, number = c(3, 7),
       overlap = c(-.5, .1)) # negative overlap DROPS values

## given two factors
Index <- seq(length = nrow(warpbreaks)) # to get nicer default labels
coplot(breaks ~ Index | wool * tension, data = warpbreaks,
       show.given = 0:1)
coplot(breaks ~ Index | wool * tension, data = warpbreaks,
       col = "red", bg = "pink", pch = 21,
       bar.bg = c(fac = "light blue"))

## Example with empty panels:
with(data.frame(state.x77), {
coplot(Life.Exp ~ Income | Illiteracy * state.region, number = 3,
       panel = function(x, y, ...) panel.smooth(x, y, span = .8, ...))
## y ~ factor -- not really sensible, but 'show off':
coplot(Life.Exp ~ state.region | Income * state.division,
       panel = panel.smooth)
})


[Package graphics version 3.2.2 Index]

赞一个(116) | 阅读(12169)
上一篇:R语言- screen() 函数 (中文帮助)
下一篇:R语言- contour () 函数 (中文帮助)
 

胡桃木屋版权所有@2013 湘ICP备13006789号-1