Description Usage Arguments Value Examples
Arranges data points using quasirandom noise (van der Corput sequence), pseudorandom noise or alternatively positioning extreme values within a band to the left and right to form beeswarm/onedimensional scatter/strip chart style plots. That is a plot resembling a cross between a violin plot (showing the density distribution) and a scatter plot (showing the individual points). This function returns a vector of the offsets to be used in plotting.
1 2 3 4 5 
y 
vector of data points 
x 
a grouping factor for y (optional) 
width 
the maximum spacing away from center for each group of points. Since points are spaced to left and right, the maximum width of the cluster will be approximately width*2 (0 = no offset, default = 0.4) 
varwidth 
adjust the width of each group based on the number of points in the group 
... 
additional arguments to offsetSingleGroup 
maxLength 
multiply the offset by sqrt(length(y)/maxLength) if not NULL. The sqrt is to match boxplot (allows comparison of order of magnitude different ns, scale with standard error) 
method 
method used to distribute the points:

nbins 
the number of points used to calculate density (defaults to 1000 for quasirandom and pseudorandom and 100 for others) 
adjust 
adjust the bandwidth used to calculate the kernel density (smaller values mean tighter fit, larger values looser fit, default is 1) 
a vector with of xoffsets of the same length as y
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  ## Generate fake data
dat < list(rnorm(50), rnorm(500), c(rnorm(100), rnorm(100,5)), rcauchy(100))
names(dat) < c("Normal", "Dense Normal", "Bimodal", "Extremes")
## Plot each distribution with a variety of parameters
par(mfrow=c(4,1), mar=c(2,4, 0.5, 0.5))
sapply(names(dat),function(label) {
y<dat[[label]]
offsets < list(
'Default'=offsetX(y),
'Smoother'=offsetX(y, adjust=2),
'Tighter'=offsetX(y, adjust=0.1),
'Thinner'=offsetX(y, width=0.1)
)
ids < rep(1:length(offsets), sapply(offsets,length))
plot(unlist(offsets) + ids, rep(y, length(offsets)),
ylab=label, xlab='', xaxt='n', pch=21, las=1)
axis(1, 1:4, c("Default", "Adjust=2", "Adjust=0.1", "Width=10%"))
})

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.