Description Usage Arguments Author(s) See Also Examples
An alternative to boxplot
. Equations are not accepted. Instead, the second argument, fact
, is used to split the data.
1 2 3 4 5 |
x |
A numerical vector. |
fact |
A character or factor vector defining the grouping for side-by-side box plots. |
horiz |
If |
width |
The width of the boxes in the plot. Value between |
lwd |
Width of lines used in box and whiskers. |
lcol |
Color of the box, median, and whiskers. |
medianLwd |
Width of the line marking the median. |
pch |
Plotting character of outliers. |
pchCex |
Size of outlier character. |
col |
Color of outliers. |
add |
If |
key |
The order in which to display the side-by-side boxplots. If locations are specified in |
axes |
Whether to plot the axes. |
xlab |
Label for the x axis. |
ylab |
Label for the y axis. |
xlim |
Limits for the x axis. |
ylim |
Limits for the y axis. |
na.rm |
Indicate whether |
... |
Additional arguments to plot. |
David Diez
histPlot
, dotPlot
, densityPlot
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 35 36 37 38 39 40 41 42 43 44 45 | data(run10)
par(mfrow=1:2)
#===> comparison 1 <===#
boxPlot(run10$time)
boxplot(run10$time)
#===> comparison 2 <===#
boxPlot(run10$time, run10$gender, col=fadeColor('black', '22'))
boxplot(run10$time ~ run10$gender)
#===> modifications using boxPlot <===#
par(mfrow=c(2,2))
boxPlot(run10$time, run10$gender)
boxPlot(run10$time, run10$gender, xlab='gender',
ylab='run time (min)',
col=fadeColor('black', '18'))
plot(0,0, xlab='gender', ylab='run time (min)',
xlim=c(0,6), ylim=c(30, 180), axes=FALSE)
boxPlot(run10$time, run10$gender, width=0.5, lwd=2,
lcol=4, medianLwd=4, pch=1, pchCex=1, col=4,
add=c(1,2,5), key=c('M','F','N'))
plot(0,0, ylab='gender', xlab='run time (min)',
xlim=c(30, 180), ylim=c(0, 3), axes=FALSE)
boxPlot(run10$time, run10$gender, horiz=TRUE,
xlab='run time (min)', ylab='gender',
add=1:2, key=c('F','M'))
# 'key' can be used to restrict to only the
# desired groups
#===> combine boxPlot and dotPlot <===#
data(tips)
par(mfrow=c(1,1))
boxPlot(tips$tip, tips$day, horiz=TRUE, key=c('Tuesday', 'Friday'))
dotPlot(tips$tip, tips$day, add=TRUE, at=1:2+0.05,
key=c('Tuesday', 'Friday'))
#===> adding a box <===#
par(mfrow=1:2)
boxPlot(run10$time[run10$gender=='M'], xlim=c(0,3))
boxPlot(run10$time[run10$gender=='F'], add=2, axes=FALSE)
axis(1, at=1:2, labels=c('M', 'F'))
boxPlot(run10$time[run10$gender=='M'], ylim=c(0,3), horiz=TRUE)
boxPlot(run10$time[run10$gender=='F'], add=2, horiz=TRUE, axes=FALSE)
axis(2, at=1:2, labels=c('M', 'F'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.