amBoxplot: Plotting boxplot using rAmCharts

View source: R/chart_amBoxplot.R

amBoxplotR Documentation

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

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

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

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

## S3 method for class 'formula'
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.

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


## Not run: 
# '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])


## End(Not run)
# Other examples available which can be time consuming depending on your configuration.

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

## End(Not run)
## Not run: 
# --- 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")

## End(Not run)
## Not run: 
# --- 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")

## End(Not run)

datastorm-open/rAmCharts documentation built on Oct. 4, 2022, 7:07 p.m.