Learn R Programming

rAmCharts (version 2.1.16)

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, ...)

# S3 method for default amBoxplot( object, xlab = NULL, ylab = NULL, ylim = NULL, names = NULL, col = "#1e90ff", horiz = FALSE, ... )

# S3 method for data.frame amBoxplot( object, id = NULL, xlab = NULL, ylab = NULL, ylim = NULL, col = NULL, horiz = FALSE, ... )

# S3 method for matrix amBoxplot( object, use.cols = TRUE, xlab = NULL, ylab = NULL, ylim = NULL, col = NULL, horiz = FALSE, ... )

# S3 method for formula amBoxplot( object, data = NULL, id = NULL, xlab = NULL, ylab = NULL, ylim = NULL, col = NULL, horiz = FALSE, ... )

Value

An object of class AmChart.

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.

References

See online documentation https://datastorm-open.github.io/introduction_ramcharts/ and amChartsAPI

See Also

amOptions, amBarplot, amBoxplot, amHist, amPie, amPlot, amTimeSeries, amStockMultiSet, amBullet, amRadar, amWind, amFunnel, amAngularGauge, amSolidGauge, amMekko, amCandlestick, amFloatingBar, amOHLC, amWaterfall

Examples

Run this code

if (FALSE) {
# 'numeric' (default)
amBoxplot(rnorm(100))

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

# 'formula', two group
data <- InsectSprays
data$group <- c("H", "F")
amBoxplot(count ~ spray + group, data = data, col = c("purple", "darkblue"))

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

# 'data.frame'
amBoxplot(iris[, 1:4])

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

if (FALSE) {
don <- data.frame(a = 1:10, b = 1:5)
amBoxplot(don, ylim = c(0,15))
}
if (FALSE) {
# --- 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")
}
if (FALSE) {
# --- 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 = FALSE)

# 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