viopoints(viopoints)
viopoints()所属R语言包:viopoints
1-D Scatter Plots with Jitter Using Kernel Density Estimates
1-D散点图使用的内核密度估计与抖动
译者:生物统计家园网 机器人LoveR
描述----------Description----------
viopoints draws one dimensional scatter plots with jitter using kernel density estimates. The plots are similar to stripchart when the sample size is small. If the sample size is large, the plots are similar to violin plots.
viopoints绘制一个三维散点图使用的内核密度估计与抖动。上图是类似stripchart时,样本量小。如果样本规模大,图,类似小提琴图。
用法----------Usage----------
viopoints(x, ...)
## S3 method for class 'formula'[类formula的方法]
viopoints(formula, data = NULL, ..., subset, na.action = NULL)
## Default S3 method:[默认方法]
viopoints(x, ..., groups, na.group = FALSE,
method = "violin", side = "both", amount = jitter,
jitter = 0.2, offset = 1, density.par = list(na.rm = TRUE),
horizontal = !vertical, vertical = TRUE, at, points = TRUE,
pch = par("pch"), cex = par("cex"), col = "red", bg = "pink",
lines = FALSE, line.lty = par("lty"), line.lwd = 0.5,
line.col = "lightgray", add = FALSE, axes = TRUE,
frame.plot = axes, axis.par, group.names, main = "", sub = "",
xlab, ylab, dlab = "", glab = "", xlim, ylim, log = "")
参数----------Arguments----------
参数:formula
a formula, such as y ~ g, where y is a numeric vector or matrix of data values to be split into groups according to the grouping variable g (usually a factor). A matrix is allowed for y. A formula of the form y ~ 1 indicates no grouping.
一个公式,如y ~ g,其中y是一个数字的数据值的向量或矩阵被分成不同的小组根据分组变量g(通常是一个因素的)。 A矩阵允许y。一个公式的形式y ~ 1的表示不分组。
参数:data
a data frame (or list) from which the variables in formula should be taken.
一个数据框(或列表)中的变量formula应采取。
参数:...
For the formula method, further arguments to be passed to the default method. For the default method, additional data.
公式法,进一步的参数被传递到默认的方法。默认的方法,更多的数据。
参数:subset
an optional vector specifying a subset of observations to be used for plotting.
一个可选的矢量指定的观测值的一个子集被用于进行绘图。
参数:na.action
a function which indicates what should happen when the data contain NAs. The default is to ignore missing values in either the response or the group.
一个函数,它表示当数据包含港定居,会发生什么。默认情况下是忽略遗漏值的响应或组。
参数:x
data, either a numeric vector, matrix or data frame (list).
数据,或者一个数值向量,矩阵或数据框(列表)。
参数:groups
grouping variable (usually a factor).
分组变量(通常是一个因素)。
参数:na.group
logical, if false (the default) drop an 'NA' level from groups.
逻辑,如果为false(默认值)下降一个NA水平groups。
参数:method
the method to be used to separate coincident points. The points are jitterd using kernel density estimates if "violin" (the default) is specified. The points are uniformly jittered if "jitter" is specified. The points are overplotted if "overplot" is specified. The coincident points are stacked if "stack" is specified. The last method only makes sense for very granular data.
要使用的方法分离重合点。的的点jitterd使用内核密度估计,如果"violin"(默认值)指定。如果"jitter"指定的点均匀地抖动。点overplotted,如果"overplot"指定。堆叠如果"stack"指定的重合点。只有最后一种方法是有道理的,非常精确的数据。
参数:amount, jitter
the amount of jitter when the method "violin" or "jitter" is used, the height of stack if the method "stack" is used. In the latter case, NA may be specified for the stack without a height adjustment. If amount is not specified, jitter can be used as the amount of jitter.
当方法"violin"或"jitter"被用于,如果堆栈的高度方法"stack"使用的抖动量。在后者的情况下,NA可以指定为堆栈没有高度调整。如果amount没有被指定,jitter可以用作的抖动量。
参数:offset
when the method "stack" is used, points are stacked with the specified offset.
时的方法"stack"时,点上摆满了指定的偏移量。
参数:density.par
list of arguments passed to density.
列表中的参数传递给density。
参数:horizontal, vertical
logical. If horizontal is FALSE (the default), the plots are drawn vertically with the first plot to the left. If horizontal is TRUE, the plots are drawn horizontally with the first plot at the bottom. If horizontal is not specified, vertical can be used to set a graph orientation.
逻辑。 horizontal如果是FALSE(默认值),图的垂直绘制的第一条曲线的左侧。 horizontal如果是TRUE,图绘制水平与第一条曲线的底部。如果horizontal没有被指定,vertical可以用来设置的曲线图的方向。
参数:at
a numeric vector giving the locations where component plots should be drawn; defaults to 1:k where k is the number of components. Non-unique values can be specified. The argument at will be recycled to the number of components if necessary. See Details below.
一个数字部件图应绘制矢量的位置,默认为1:k其中k的元件数量。非唯一的值可以被指定。参数at将被回收利用如果必要的组成部分的数目。请参见下面的详细信息。
参数:side
the side on which the points are plotted, one of "both" (the default), "positive" or "negative". The argument side will be recycled to the number of components if necessary. See Details below.
侧上,点绘,"both"(默认值),"positive"或"negative"。参数side将被回收利用如果必要的组成部分的数目。请参见下面的详细信息。
参数:points
logical, if true (the default) draw points.
逻辑,如果为true(缺省值)绘制点。
参数:pch, cex, col, bg
graphical parameters passed to points. Parameters will be recycled if necessary. See Details below.
图形参数传递给points。如果必要的参数将被回收利用。请参见下面的详细信息。
参数:lines
logical, if true draw lines in a similar way to parallel coordinates plots, defaults to FALSE.
逻辑,如果真画线平行坐标图,以类似的方式默认为FALSE。
参数:line.lty, line.lwd, line.col
the line type, width and color for lines, passed to arrows. Parameters will be recycled if necessary. See Details below.
线路类型,宽度和颜色的线,传递给arrows。如果必要的参数将被回收利用。请参见下面的详细信息。
参数:add
logical, if true add points or lines to current plot, defaults to FALSE.
逻辑,如果真正的加点或线,目前积,默认为FALSE。
参数:axes
logical, whether to plot axes; defaults to TRUE.
逻辑,是否要绘制的轴,默认为TRUE。
参数:frame.plot
logical, indicating if a frame (box) should be drawn; defaults to TRUE unless axes=FALSE is specified.
逻辑,如果一个帧(box)应制定;默认为TRUE除非axes=FALSE被指定。
参数:axis.par
list of arguments passed to axis. If specified, group.names is ignored.
列表中的参数传递给axis。如果指定,group.names被忽略。
参数:group.names
labels for the group axis.
组轴的标签。
参数:main, sub, xlab, ylab
character strings for annotation, passed to title.
注释字符的字符串传递给title。
参数:dlab, glab
an alternative way to specify axis labels: see Details below.
指定轴标签的另一种方式:请参阅下面的详细信息。
参数:xlim, ylim
numeric vectors of length 2, giving the range for the plot, passed to plot.window.
数字向量长度为2,图的范围,通过plot.window。
参数:log
a character string, indicating if any axis should be drawn in log scale, passed to plot.window.
一个字符串,表示如果任何轴应绘制在对数刻度,传递给plot.window。
Details
详细信息----------Details----------
The number of components k is the product of the number of (column) vectors n and the number of levels of group m. Arguments at and side are recycled to the length k. Graphical parameters pch, cex, col, bg, line.lty, line.lwd, line.col are recycled as follows. If the length of a parameter is greater than m, the parameter is recycled to the length k. Otherwise the parameter is recycled to the length m first, then each element of the parameter is repeated n times.
的数目的组件k是(列)向量n和的组m水平的数目的数目的乘积。参数at和side被回收的长度k。图形参数pch,cex,col,bg,line.lty,line.lwd,line.col回收如下。如果一个参数的长度是大于m,该参数被循环的长度k。否则,该参数被循环的长度m第一,然后重复的参数是每个元素n倍。
The dlab and glab labels may be used instead of xlab and ylab if those are not specified. dlab applies to the continuous data axis (the y axis if horizontal=FALSE or vertical=TRUE), glab to the group axis.
dlab和glab标签可以被用来代替xlab和ylab,如果未指定。 dlab适用于连续的数据轴(Y轴如果horizontal=FALSE或vertical=TRUE)glab组轴。
If add=TRUE, arguments axes, frame.plot, axis.par, group.names, main, sub, xlab, ylab, dlab, glab, xlim, ylim, log will be ignored.
如果add=TRUE,参数axes,frame.plot,axis.par,group.names,main,sub,xlab, ylab,dlab,glab,xlim,ylim,log会被忽略。
Points are drawn after lines so that lines do not hide points.
让线条不隐藏点点线后得出的。
值----------Value----------
An invisible numeric vector,
有一条无形的数值向量,
(作者)----------Author(s)----------
Yuki Atoh <a href="mailto:yuki.atoh@gmail.com">yuki.atoh@gmail.com</a>
参考文献----------References----------
Hintze, J. L. and Nelson, R. D. (1998). Violin plots: a box plot-density trace synergism. The American Statistician, 52(2):181-184.
参见----------See Also----------
boxplot, stripchart, density, vioplot in package vioplot, beanplot in package beanplot, beeswarm in package beeswarm, parviol in package parviol
boxplot,stripchart,density,vioplot的包vioplot,beanplot的包beanplot,beeswarm包beeswarm,parviol包parviol
实例----------Examples----------
op <- par(mfrow=c(2,2))
gn <- c("SL", "SW", "PL", "PW")
for (i in c("overplot", "stack", "jitter", "violin"))
viopoints(iris[1:4], method=i, horizontal=TRUE, col=2:5, group.names=gn,
main=i)
par(op)
boxplot(Sepal.Length ~ Species, data=iris, ylab="Sepal.Length")
viopoints(Sepal.Length ~ Species, data=iris, col=2:4, add=TRUE)
boxplot(iris[1:4])
viopoints(iris[1:4], groups=iris[5], col=2:4, at=1:4+rep(c(-0.2,0,0.2),each=4),
jitter=0.1, add=TRUE)
legend("topright", legend=levels(factor(iris[,5])), pch=1, col=2:4)
boxplot(iris[1:4])
viopoints(as.matrix(iris[1:4])~iris[,5], col=2:4, at=1:4,
lines=TRUE, line.col=c("pink", "lightgreen", "skyblue"), add=TRUE)
legend("topright", legend=levels(factor(iris[,5])), pch=1, col=2:4)
viopoints(iris[c(1,3)], groups=iris[5], method="stack", amount=NA,
at=rep(1:3,each=2), pch=rep(1:2,3), side=c("n","p"), col=rep(2:3,3),
group.names=levels(factor(iris[,5])), main="stack")
legend("topleft", pch=1:2, col=2:3, legend=colnames(iris[c(1,3)]))
## Not run: [#不运行:]
viopoints(as.matrix(iris[1:4]) ~ Species, data=iris, jitter=0.3, col=2:4,
axis.par=list(at=1:12, labels=paste(rep(substr(levels(factor(iris[,5])),1,3),
each=4), c("SL","SW","PL","PW"), sep="."), cex.axis=0.8, las=3))
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|