smoothScatter(graphics)
smoothScatter()所属R语言包:graphics
Scatterplots with Smoothed Densities Color Representation
散点图与光滑密度的颜色表示
译者:生物统计家园网 机器人LoveR
描述----------Description----------
smoothScatter produces a smoothed color density representation of the scatterplot, obtained through a kernel density estimate. densCols produces a vector containing colors which encode the local densities at each point in a scatterplot.
smoothScatter生产散点图平滑的色彩密度表示,通过核密度估计得到。 densCols产生一个向量,包含颜色编码在散点图中的每个点的地方密度。
用法----------Usage----------
smoothScatter(x, y = NULL, nbin = 128, bandwidth,
colramp = colorRampPalette(c("white", blues9)),
nrpoints = 100, pch = ".", cex = 1, col = "black",
transformation = function(x) x^.25,
postPlotHook = box,
xlab = NULL, ylab = NULL, xlim, ylim,
xaxs = par("xaxs"), yaxs = par("yaxs"), ...)
参数----------Arguments----------
参数:x, y
the x and y arguments provide the x and y coordinates for the plot. Any reasonable way of defining the coordinates is acceptable. See the function xy.coords for details. If supplied separately, they must be of the same length.
x和y参数提供X和Y坐标图。任何合理的方式是可以接受的定义的坐标。请参阅功能细节xy.coords。如果单独提供的,它们必须是相同的长度。
参数:nbin
numeric vector of length one (for both directions) or two (for x and y separately) specifying the number of equally spaced grid points for the density estimation; directly used as gridsize in bkde2D().
数值向量的长度为一(两个方向)或两个(分别为X和Y)指定的密度估计等距格点的数量;直接用于gridsizebkde2D()。
参数:bandwidth
numeric vector (length 1 or 2) of smoothing bandwidth(s). If missing, a more or less useful default is used. bandwidth is subsequently passed to function bkde2D.
数字矢量(长度为1或2)平滑(S)的带宽。如果失踪,或多或少有用的默认值。 bandwidth随后被传递给函数bkde2D。
参数:colramp
function accepting an integer n as an argument and returning n colors.
函数接受一个整数n作为参数和返回n颜色。
参数:nrpoints
number of points to be superimposed on the density image. The first nrpoints points from those areas of lowest regional densities will be plotted. Adding points to the plot allows for the identification of outliers. If all points are to be plotted, choose nrpoints = Inf.
点数密度图像上叠加。第一nrpoints点从这些区域的最低区域密度将绘制。加分的图,允许为离群鉴定。如果所有的点都被绘制,选择nrpoints = Inf。
参数:pch, cex, col
arguments passed to points, when nrpoints > 0: point symbol, character expansion factor and color, see also par.
参数传递到points时nrpoints > 0:点符号,字符的膨胀系数和颜色,也看到par。
参数:transformation
function mapping the density scale to the color scale.
函数映射密度规模的色阶。
参数:postPlotHook
either NULL or a function which will be called (with no arguments) after image.
无论是NULL或将称为后image(不带参数)的功能。
参数:xlab, ylab
character strings to be used as axis labels, passed to image.
轴标签使用的字符的字符串,通过image。
参数:xlim, ylim
numeric vectors of length 2 specifying axis limits.
指定轴的极限数值向量的长度为2。
参数:xaxs, yaxs, ...
further arguments, passed to image.
进一步的论据,通过image。
Details
详情----------Details----------
smoothScatter produces a smoothed version of a scatter plot. Two dimensional (kernel density) smoothing is performed by bkde2D from package KernSmooth. See the examples for how to use this function together with pairs.
smoothScatter产生的散点图平滑的版本。二维(内核密度)平滑bkde2D包KernSmooth。用pairs如何使用此功能的例子。
作者(S)----------Author(s)----------
Florian Hahne at FHCRC, originally
参见----------See Also----------
bkde2D from package KernSmooth; densCols which uses the same smoothing computations and blues9 in package grDevices.
bkde2D包KernSmooth;,densCols使用相同的平滑计算和blues9包grDevices。
scatter.smooth adds a loess regression smoother to a scatter plot.
scatter.smooth添加loess回归平滑散点图。
举例----------Examples----------
## A largish data set[#稍大数据集,]
n <- 10000
x1 <- matrix(rnorm(n), ncol=2)
x2 <- matrix(rnorm(n, mean=3, sd=1.5), ncol=2)
x <- rbind(x1,x2)
oldpar <- par(mfrow=c(2,2))
smoothScatter(x, nrpoints=0)
smoothScatter(x)
## a different color scheme:[#不同的配色方案:]
Lab.palette <-
colorRampPalette(c("blue", "orange", "red"), space = "Lab")
smoothScatter(x, colramp = Lab.palette)
## somewhat similar, using identical smoothing computations,[#有点类似,使用相同的平滑计算,]
## but considerably *less* efficient for really large data:[#但相当少*有效的真正的大数据:]
plot(x, col = densCols(x), pch=20)
## use with pairs:[#成对使用:]
par(mfrow=c(1,1))
y <- matrix(rnorm(40000), ncol=4) + 3*rnorm(10000)
y[, c(2,4)] <- -y[, c(2,4)]
pairs(y,
panel = function(...) smoothScatter(..., nrpoints=0, add=TRUE))
par(oldpar)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|