smoothScatter(x, y, bandwidth, nrpoints=100)
Create a density plot of bivariate data using smoothScatter.
  • x – Numeric vector for x-coordinate.
  • y – Numeric vector for y-coordinate.
  • bandwidth – A vector of length 1 or 2 specifying the bandwidth in the kernel density estimate. A default bandwidth will be chosen if this argument is not specified.
  • nrpoints – The number of points to explicitly show on the plot.

Example. Two examples of smoothScatter are shown. First, with defaults. Second, the bandwidth was specified to be a little larger than the default, and five points are specified to be shown using the open circle plotting character.
> x <- rchisq(1000, 4) + rnorm(1000)
> y <- rnorm(1000, 7)
> smoothScatter(x, y)
> smoothScatter(x, y, bandwidth=c(3,1)/3, nrpoints=5, pch=1)

Leave a Reply