spineplot(graphics)
spineplot()所属R语言包:graphics
Spine Plots and Spinograms
脊柱图解和Spinograms
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Spine plots are a special cases of mosaic plots, and can be seen as a generalization of stacked (or highlighted) bar plots. Analogously, spinograms are an extension of histograms.
脊柱图是一个特殊的镶嵌图的情况下,作为一个堆叠(或强调)条形图的推广可以看出。类似地,spinograms直方图扩展。
用法----------Usage----------
spineplot(x, ...)
## Default S3 method:[默认方法]
spineplot(x, y = NULL,
breaks = NULL, tol.ylab = 0.05, off = NULL,
ylevels = NULL, col = NULL,
main = "", xlab = NULL, ylab = NULL,
xaxlabels = NULL, yaxlabels = NULL,
xlim = NULL, ylim = c(0, 1), axes = TRUE, ...)
## S3 method for class 'formula'[类formula的方法]
spineplot(formula, data = NULL,
breaks = NULL, tol.ylab = 0.05, off = NULL,
ylevels = NULL, col = NULL,
main = "", xlab = NULL, ylab = NULL,
xaxlabels = NULL, yaxlabels = NULL,
xlim = NULL, ylim = c(0, 1), axes = TRUE, ...,
subset = NULL)
参数----------Arguments----------
参数:x
an object, the default method expects either a single variable (interpreted to be the explanatory variable) or a 2-way table. See details.
一个对象,默认的方法,预计单变量(解释为解释变量)或2路表。查看详情。
参数:y
a "factor" interpreted to be the dependent variable
"factor"解释为因变量
参数:formula
a "formula" of type y ~ x with a single dependent "factor" and a single explanatory variable.
"formula"的类型y ~ x依赖"factor"和一个单一的解释变量。
参数:data
an optional data frame.
一个可选的数据框。
参数:breaks
if the explanatory variable is numeric, this controls how it is discretized. breaks is passed to hist and can be a list of arguments.
如果解释变量是数字,这个离散它是如何控制的。 breaks是传递hist的和可以是一个参数列表。
参数:tol.ylab
convenience tolerance parameter for y-axis annotation. If the distance between two labels drops under this threshold, they are plotted equidistantly.
Y轴标注方便性参数。如果两个标签之间的距离在此阈值下降,他们绘制等距。
参数:off
vertical offset between the bars (in per cent). It is fixed to 0 for spinograms and defaults to 2 for spine plots.
条形(%)之间的垂直偏移。它是固定的0到2脊柱图spinograms和违约。
参数:ylevels
a character or numeric vector specifying in which order the levels of the dependent variable should be plotted.
为了因变量水平指定的字符或数字向量应绘制。
参数:col
a vector of fill colors of the same length as levels(y). The default is to call gray.colors.
填充颜色相同的长度为levels(y)向量。默认是调用gray.colors。
参数:main, xlab, ylab
character strings for annotation
注释字符串
参数:xaxlabels, yaxlabels
character vectors for annotation of x and y axis. Default to levels(y) and levels(x), respectively for the spine plot. For xaxlabels in the spinogram, the breaks are used.
X和Y轴标注的特征向量。默认为levels(y)和levels(x),分别为脊椎曲线。为xaxlabels在该spinogram,用于截断。
参数:xlim, ylim
the range of x and y values with sensible defaults.
合理的默认值x和y值的范围。
参数:axes
logical. If FALSE all axes (including those giving level names) are suppressed.
逻辑。如果FALSE所有轴(包括那些给级别名称)被抑制。
参数:...
additional arguments passed to rect.
额外的参数传递到rect。
参数:subset
an optional vector specifying a subset of observations to be used for plotting.
指定一个可选的向量绘图观测的子集。
Details
详情----------Details----------
spineplot creates either a spinogram or a spine plot. It can be called via spineplot(x, y) or spineplot(y ~ x) where y is interpreted to be the dependent variable (and has to be categorical) and x the explanatory variable. x can be either categorical (then a spine plot is created) or numerical (then a spinogram is plotted). Additionally, spineplot can also be called with only a single argument which then has to be a 2-way table, interpreted to correspond to table(x, y).
spineplot创建一个spinogram,或脊椎图。它可以被称为通过spineplot(x, y)或spineplot(y ~ x)y被解释为因变量(是分类)x解释变量。 x可以是类别(脊柱图创建)或数字(,然后spinogram绘制)。此外,spineplot也可以被称为只有一个参数,然后是一个2路表对应table(x, y)解释。
Both, spine plots and spinograms, are essentially mosaic plots with special formatting of spacing and shading. Conceptually, they plot P(y | x) against P(x). For the spine plot (where both x and y are categorical), both quantities are approximated by the corresponding empirical relative frequencies. For the spinogram (where x is numerical), x is first discretized (by calling hist with breaks argument) and then empirical relative frequencies are taken.
,脊柱图和spinograms,本质上是特殊格式间距和底纹镶嵌图。从概念上讲,他们图P(y | x)对P(x)。为脊椎图(其中两个x和y是明确的),这两个数量由相应的经验相对频率近似。为spinogram(其中x是数值),x第一次离散(通过调用hist经验与breaks参数),然后采取相对频率。
Thus, spine plots can also be seen as a generalization of stacked bar plots where not the heights but the widths of the bars corresponds to the relative frequencies of x. The heights of the bars then correspond to the conditional relative frequencies of y in every x group. Analogously, spinograms extend stacked histograms.
因此,脊柱图也可以被看作一个堆积条形图图的高度,但条形的宽度对应x相对频率的推广。条形的高度,然后对应y每x组有条件的相对频率。类似地中,spinograms扩展堆叠柱状图。
值----------Value----------
The table visualized is returned invisibly.
返回表的可视化于无形。
作者(S)----------Author(s)----------
Achim Zeileis <a href="mailto:Achim.Zeileis@R-project.org">Achim.Zeileis@R-project.org</a>
参考文献----------References----------
Journal of the American Statistical Association, 89, 190–200.
The American Statistician, 38, 32–35.
conditional distributions, Unpublished Manuscript.
Computational Statistics, 11, 23–33.
参见----------See Also----------
mosaicplot, hist, cdplot
mosaicplot,hist,cdplot
举例----------Examples----------
## treatment and improvement of patients with rheumatoid arthritis[#类风湿关节炎患者的治疗和改善]
treatment <- factor(rep(c(1, 2), c(43, 41)), levels = c(1, 2),
labels = c("placebo", "treated"))
improved <- factor(rep(c(1, 2, 3, 1, 2, 3), c(29, 7, 7, 13, 7, 21)),
levels = c(1, 2, 3),
labels = c("none", "some", "marked"))
## (dependence on a categorical variable)[依赖于一个明确的变量(#)]
(spineplot(improved ~ treatment))
## applications and admissions by department at UC Berkeley[#应用程序和招生部门在加州大学伯克利分校]
## (two-way tables)[#(双向表)]
(spineplot(margin.table(UCBAdmissions, c(3, 2)),
main = "Applications at UCB"))
(spineplot(margin.table(UCBAdmissions, c(3, 1)),
main = "Admissions at UCB"))
## NASA space shuttle o-ring failures[#美国宇航局航天飞机O形圈的失败]
fail <- factor(c(2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1,
1, 1, 1, 2, 1, 1, 1, 1, 1),
levels = c(1, 2), labels = c("no", "yes"))
temperature <- c(53, 57, 58, 63, 66, 67, 67, 67, 68, 69, 70, 70,
70, 70, 72, 73, 75, 75, 76, 76, 78, 79, 81)
## (dependence on a numerical variable)[依赖于数值变量(#)]
(spineplot(fail ~ temperature))
(spineplot(fail ~ temperature, breaks = 3))
(spineplot(fail ~ temperature, breaks = quantile(temperature)))
## highlighting for failures[#突出的故障]
spineplot(fail ~ temperature, ylevels = 2:1)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|