## One of the examples from 'stripchart'
beeswarm(decrease ~ treatment,
data = OrchardSprays, log = TRUE,
pch = 16, col = rainbow(8))
## Demonstrating the use of 'pwcol'
data(breast)
beeswarm(ESR1 ~ ER, data = breast,
pch = 16, pwcol = event_survival + 1)
legend('topleft', legend = c('censored', 'metastasis'),
pch = 16, col = 1:2)
## Demonstrating 'smile' method
beeswarm(time_survival ~ event_survival, data = breast,
method = 'smile',
pch = 16, pwcol = as.numeric(ER),
xlab = '', ylab = 'Follow-up time (months)',
labels = c('Censored', 'Metastasis'))
legend('topright', legend = levels(breast$ER),
title = 'ER', pch = 16, col = 1:2)
## The list interface
distributions <- list(runif = runif(100, min = -3, max = 3),
rnorm = rnorm(100))
beeswarm(distributions, col = 2:3)
## the "bg" argument only has an effect if "pch" is in 21:25
beeswarm(distributions, pch = 21, bg = 2:3)
## the "smile" method
beeswarm(distributions, col = 2:3, method = 'smile')
## use of pwcol with the list interface
myCol <- lapply(distributions, cut, breaks = 8)
beeswarm(distributions, pch = 16, pwcol = myCol)
## log scale
beeswarm(1:200, log = TRUE)
Run the code above in your browser using DataLab