wvioplot(wvioplot)
wvioplot()所属R语言包:wvioplot
weighted violin plot
加权小提琴图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Produce violin plot(s) of the given values, taking weights into account. This package builds on Daniel Adler's excellent vioplot package.
生产小提琴图(s)的给定值,同时考虑到的权重。此包建立在丹尼尔·阿德勒的的优秀vioplot包。
用法----------Usage----------
wvioplot(x, ..., range = 1.5, h = NULL, ylim = NULL, names = NULL,
horizontal = FALSE, col = "grey", border = "black", lty = 1,
lwd = 1, rectCol = "black", colMed = "white", pchMed = 19,
at, add = FALSE, wex = 1, drawRect = TRUE, centpt = "median",
weights = NULL, adjust = 3, clip = TRUE)
参数----------Arguments----------
参数:x
data vector
数据向量
参数:...
additional data vectors
其他数据向量
参数:range
a factor to calculate the upper/lower adjacent values
一个因素来计算的上部/下部的相邻值
参数:h
the height for the density estimator, if omit as explained in sm.density, h will be set to an optimum
,如果省略了解释sm.density的密度估计的高度,h将被设置到一个最佳
参数:ylim
y limits
Ÿ限制
参数:names
one label, or a vector of labels for the datas must match the number of datas given
一个标签,或标签中数据的向量必须与给定的景致
参数:col, border, lty, lwd
Graphical parameters for the violin passed to lines and polygon
图形参数传递给线和多边形的小提琴
参数:rectCol, colMed, pchMed
Graphical parameters to control the look of the box
图形参数控制框的外观
参数:drawRect
logical. the box is drawn if TRUE.
逻辑。如果TRUE框画。
参数:at
position of each violin. Default to 1:n
每把小提琴的位置。默认1:n
参数:add
logical. if FALSE (default) a new plot is created
逻辑。如果为FALSE(默认值)创建一个新的图
参数:wex
relative expansion of the violin.
相对扩张的小提琴。
参数:horizontal
logical. horizontal or vertical violins
逻辑。水平或垂直小提琴
参数:centpt
one of "mean" or "median", indicating whether to use the median or mean for the center point
一个“平均”或“中间”,表示是否使用中位数或平均的中心点
参数:weights
either a vector of character weights or a list containing one vector of weights per data vector. Each weight vector must be the same length as each data vector
无论是矢量的字符权值或一个列表,包含每个数据向量的一个矢量的权重。必须是相同的每个权重矢量的长度作为每个数据向量
参数:adjust
smoothing parameter. This will govern the smoothness of the sides of the body of each violin. This argument is passed to the kernel density function.
平滑参数。这将支配的主体的两侧的每把小提琴的平滑性。这个参数被传递给内核密度函数。
参数:clip
logical. Should the extremes of the violin be clipped to the limits of the data?
逻辑。极端的小提琴被裁剪的数据的限制呢?
Details
详细信息----------Details----------
A violin plot is a combination of a box plot and a kernel density plot. Specifically, it starts with a box plot. It then adds a rotated kernel density plot to each side of the box plot. Each NA value in the data and each corresponding weight value are automatically removed.
小提琴图相结合的箱线图和核密度图。具体地说,它开始以一个盒形图。然后,它增加了一个旋转的内核密度图,每边的方块图。每个NA中的数据值和每个对应的权重值被自动删除。
(作者)----------Author(s)----------
Solomon Messing <a href="mailto:messing~at~stanford...">messing~at~stanford...</a>
参考文献----------References----------
Hintze, J. L. and R. D. Nelson (1998). Violin plots: a box plot-density trace synergism. The American Statistician, 52(2):181-4.
参见----------See Also----------
vioplot boxplot density
vioplotboxplotdensity
实例----------Examples----------
# box- vs violin-plot [箱与小提琴的图]
par(mfrow=c(2,1))
mu<-2
si<-0.6
bimodal<-c(rnorm(1000,-mu,si),rnorm(1000,mu,si))
uniform<-runif(2000,-4,4)
normal<-rnorm(2000,0,3)
wvioplot(bimodal,uniform,normal)
boxplot(bimodal,uniform,normal)
# weighted versus unweighted:[加权与不加权的:]
# make up some weights:[一些权重:]
weights = rpois(2000, 1)
par(mfrow=c(2,1))
wvioplot(bimodal, uniform, normal)
wvioplot(bimodal, uniform, normal, weights = weights )
# use seperate set of weights for each variable:[使用单独为每个变量的权重集:]
weightsbi = rpois(2000, 1)
weightsun = rpois(2000, 1)
weightsno = rpois(2000, 1)
wvioplot(bimodal, uniform, normal,
weights = list(weightsbi, weightsun, weightsno) )
# be sure to pass the variables via list()[一定要通过变量通过列表()]
# use different levels of smoothing:[使用不同级别的平滑处理:]
par(mfrow=c(3,1))
wvioplot(bimodal, uniform, normal, adjust = 3) #default[默认]
wvioplot(bimodal, uniform, normal, adjust = 2)
wvioplot(bimodal, uniform, normal, adjust = 1)
# do not clip at the values of the data:[不夹在中的数据值:]
par(mfrow=c(2,1))
wvioplot(bimodal, uniform, normal, clip=TRUE) #default[默认]
wvioplot(bimodal, uniform, normal, clip=FALSE)
# add to an existing plot[添加到现有的图]
x <- rnorm(100)
y <- rnorm(100)
plot(x, y, xlim=c(-5,5), ylim=c(-5,5))
wvioplot(x, col="tomato", horizontal=TRUE, at=-4, add=TRUE,lty=2, rectCol="gray")
wvioplot(y, col="cyan", horizontal=FALSE, at=-4, add=TRUE,lty=2)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|