Description Usage Arguments Details Value Author(s) See Also Examples
This function can draw side-by-side boxplots for all the variables in a data frame or boxplots for a continous variable vs a categorical variable.
1 2 |
vars |
a list of variables (a character vector), or a
formula; a one-sided formula like |
at |
the locations of the boxplots (by default from 1 to
|
width |
width(s) of boxes (do not have to be a same value if provided as a numeric vector); by default it is about 1/10 of the screen width |
horizontal |
horizontal or vertical boxplots |
points |
whether to add data points to the boxplot |
data |
a mutaframe created by |
main |
the main title |
xlim |
a numeric vector of length 2 (like |
ylim |
y-axis limits; similar to |
xlab |
x-axis title |
ylab |
y-axis title |
Common interactions are documented in
common_key_press
. Note boxplots also supports
brushing and can respond to brushing in other plots. When we brush
in other plots which are based on the same data, there will be
“child” boxplots in this plot showing the distributions of the
brushed data.
A boxplot
Yihui Xie <http://yihui.name>
Other plots: qbar
; qdensity
;
qhist
, qspine
;
qmval
; qparallel
;
qtime
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | library(cranvas)
### (1) some test cases
df <- qdata(as.data.frame(matrix(rnorm(1000), 200)))
qboxplot(~., df)
qboxplot(~., df, horizontal = TRUE)
qboxplot(~., df, at = (1:5)^2) # at different locations
qboxplot(~., df, width = 0.1 * sample(5)) # different widths
### (2) flea data
data(flea, package = "tourr")
qflea <- qdata(flea)
## continuous vs categorical variable
qboxplot(tars1 ~ species, data = qflea)
## side-by-side boxplots for several continuous variables
qboxplot(~aede1 + aede2 + aede3, data = qflea)
## brush on other plots and we see little boxplots
qparallel(~., data = qflea)
qscatter(tars1, tars2, data = qflea)
## we can turn on the point layer too
qboxplot(tars1 ~ species, data = qflea, points = TRUE)
## show points with colors
qflea2 <- qdata(flea, color = species)
qboxplot(~aede1 + aede2 + aede3, data = qflea2, points = TRUE)
cranvas_off()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.