boxplot_h: Makes horizontal boxplots

Description Usage Arguments Details Value Examples

Description

Makes horizontal boxplots

Usage

1
2
boxplot_h(x, ycoord, n, inhgt = 20, whiskhgt = 5, bcol = "black",
  bfill = "grey", pcex = 1, lwd = 1, pch = 20)

Arguments

x

Vector of the 6 boxplot statistics (e.g. 5, 25, 50, 75, 95th percentile and mean)

ycoord

Y coordinate for plotting boxplot

n

Number of boxplots to be placed on plot

inhgt

Height of the interquartile box, scaled to size of device and number of boxes to be plotted

whiskhgt

Height of the 95th percentile whiskers, scaled in the same way as inhgt

bcol

A 1 or 4 element vector of colors for whiskers, interquartile box, median line, and mean point

bfill

Fill color for interquartile box

pcex

Size of point indicating the mean

lwd

A 1 or 3 element vector of widths for whiskers, interquartile box, and median line

Details

To be used with dummy call to plot(). Specify the number of boxes to be placed on the Y axis. The parameters for bcol and lwd will recycle the first element if the vector length is less than 4, and will only use the first 4 elements if it is longer.

Value

Boxplot

Examples

1
2
3
4
5
6
7
8
9
x <- lapply(1:4, function(x) box_stats(sample(1:100, 10)))
plot(c(1, 100), c(0, 5), pch = "", xlab = "value", ylab = "", yaxt = "n")  
#for(i in 1:length(x)) boxplot_h(x[[i]], ycoord = i, n = 4)
#for(i in 1:length(x)) boxplot_h(x[[i]], ycoord = i, n = 4, pch = 5, pcex = 2)
#for(i in 1:length(x)) boxplot_h(x[[i]], ycoord = i, n = 4, bcol = "red", bfill = "grey", whiskcol = "grey")
for(i in 1:length(x)) {
  boxplot_h(x[[i]], ycoord = i, n = 4, bcol = c("black", "grey40", "red", "blue"), bfill = "grey80", 
            lwd = c(2, 1, 7), whiskcol = "grey")
}

PrincetonUniversity/lmisc documentation built on May 8, 2019, 3:23 a.m.