smoothScatter
produces a smoothed color density
representation of a scatterplot, obtained through a (2D) kernel
density estimate.
smoothScatter(x, y = NULL, nbin = 128, bandwidth, colramp = colorRampPalette(c("white", blues9)), nrpoints = 100, ret.selection = FALSE, pch = ".", cex = 1, col = "black", transformation = function(x) x^.25, postPlotHook = box, xlab = NULL, ylab = NULL, xlim, ylim, xaxs = par("xaxs"), yaxs = par("yaxs"), ...)
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.gridsize
in bkde2D()
.bandwidth
is subsequently passed to function
bkde2D
.n
as an argument and
returning n
colors.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
.logical
indicating to return the
ordered indices of low density points if nrpoints > 0
.NULL
or a function which will be
called (with no arguments) after image
.image
.image
,
e.g., add=TRUE
or useRaster=TRUE
.ret.selection
is true, a vector of integers of length
nrpoints
(or smaller, if there are less finite points inside
xlim
and ylim
) with the indices of the low-density
points drawn, ordered with lowest density first.
smoothScatter
produces a smoothed version of a scatter plot.
Two dimensional (kernel density) smoothing is performed by
bkde2D
from package \href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}KernSmoothKernSmooth.
See the examples for how to use this function together with
pairs
.
bkde2D
from package \href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}KernSmoothKernSmooth;
densCols
which uses the same smoothing computations and
blues9
in package grDevices. scatter.smooth
adds a loess
regression smoother to a scatter plot.