Learn R Programming

rAmCharts (version 2.0.2)

amBoxplot: Plotting boxplot using rAmCharts

Description

amBoxplot computes a boxplot of the given data values. Can be a vector, a data.frame, or a matrix.

Usage

amBoxplot(object, ...)
"amBoxplot"(object, xlab = NULL, ylab = NULL, ylim = NULL, names = NULL, col = "#1e90ff", horiz = FALSE, ...)
"amBoxplot"(object, id = NULL, xlab = NULL, ylab = NULL, ylim = NULL, col = NULL, horiz = FALSE, ...)
"amBoxplot"(object, use.cols = TRUE, xlab = NULL, ylab = NULL, ylim = NULL, col = NULL, horiz = FALSE, ...)
"amBoxplot"(object, data = NULL, id = NULL, xlab = NULL, ylab = NULL, ylim = NULL, col = NULL, horiz = FALSE, ...)

Arguments

object
a vector, data.frame, a matrix, or a formula.
...
see amOptions for more options.
xlab, ylab
character, labels of the axis.
ylim
numeric, y values range with sensible defaults.
names
character, name on x-axis, if object is a vector.
col
character, color(s) to be used to fill the boxplot.
horiz
logical, TRUE to rotate chart.
id
character, column name of id to identify outliers, if object is a dataframe.
use.cols
logical, for matrix only. Set to TRUE to display boxplot based on columns.
data
data.frame, from which the variables in formula should be taken.

Value

An object of class AmChart.

See Also

Examples

Run this code
# 'numeric' (default)
amBoxplot(rnorm(100))

# 'formula'
amBoxplot(count ~ spray, data = InsectSprays)

# 'matrix'
x <- matrix(nrow = 10, ncol = 5, rnorm(50))
amBoxplot(x)

# 'data.frame'
amBoxplot(iris)


# Other examples available which can be time consuming depending on your configuration.


don <- data.frame(a = 1:10, b = 1:5)
amBoxplot(don, ylim = c(0,15))


# --- matrix
x <- matrix(nrow = 10, ncol = 5, rnorm(50))

amBoxplot(x) # on columns
colnames(x) <- LETTERS[1:5]
amBoxplot(x) # with names
amBoxplot(x, use.cols = FALSE, col = c("blue", "red"))

# Parameter for amOptions
amBoxplot(x, export = TRUE, exportFormat = "SVG")


# --- Formula
(obj <- amBoxplot(count ~ spray, data = InsectSprays))

# Adding parameters
amBoxplot(count ~ spray, data = InsectSprays, ylim = c(0,50),
          xlab = "spray", col = c("darkblue", "gray"))

# Transpose
amBoxplot(count ~ spray, data = InsectSprays, ylim = c(0,50), xlab = "spray", horiz = TRUE)

# Using a custom colum to identify outliers
InsectSprays$id <- paste0("ID : ", 1:nrow(InsectSprays))
amBoxplot(count ~ spray, data = InsectSprays, id = "id")

# Parameter for amOptions
amBoxplot(count ~ spray, data = InsectSprays, main = "amcharts")

Run the code above in your browser using DataLab