ggbox: Boxplot of a data frame / matrix using ggplot

View source: R/ggbox.r

ggboxR Documentation

Boxplot of a data frame / matrix using ggplot

Description

Works with labels, as from the labelled package. Axis labels are handled somewhat differently depending on whether a single box is present or multiple.

Usage

ggbox(X, xlab, horiz = FALSE)

Arguments

X

Matrix of values

xlab

If omitted, no space will be allocated for x axis title (ylab can be specified as usual; see examples)

horiz

Make horizontal? (default: FALSE)

Examples

ggbox(matrix(rnorm(50), 10, 5))
ggbox(matrix(rnorm(50), 10, 5), xlab='categories')
ggbox(rexp(10))
ggbox(rexp(10), 'A plot of') + ggplot2::ylab('Something')

# Using labels
X <- iris[, 1:4]
attr(X[[4]], 'label') <- "The petal's width"
ggbox(X)
ggbox(X[,4])
ggbox(X[,4], horiz=TRUE)
ggbox(X, horiz=TRUE)

pbreheny/breheny documentation built on March 30, 2024, 7:37 p.m.