Learn R Programming

rAmCharts (version 1.1.1)

amHist: Histograms

Description

amhist computes a histogram of the given data values. If plot = TRUE, the resulting object of class "histogram" before it is returned.

Usage

amHist(x, main = "Histogram", freq = TRUE, xlab = NULL, ylab = NULL,
  ylim = NULL, plot = TRUE, col = NULL, labels = TRUE, ...)

Arguments

x
a vector of values for which the histogram is desired.
main
character, title of the graph.
freq
logical; if TRUE, the histogram graphic is a representation of frequencies, the counts component of the result; if FALSE, probability densities, component density, are plotted (so that the histogram has a total area of one). Defa
xlab,ylab
character, labels of the axis.
ylim
the range of y values with sensible defaults.
plot
logical. If TRUE (default), an histogram is plotted, otherwise a list of breaks and counts is returned. In the latter case, a warning is used if (typically graphical) arguments are specified that only apply to the plot = TRUE cas
col
a colour to be used to fill the bars. The default of NULL yields unfilled bars.
labels
logical or character. Additionally draw labels on top of bars, if not FALSE; if TRUE, draw the counts or rounded densities; if labels is a character, draw itself.
...
further arguments and graphical parameters passed to plot.histogram

Examples

Run this code
x <- rnorm(100)
amHist(x = x)
amHist(x = x, freq = FALSE)
amHist(x = x, breaks = "Scott")
amHist(x = x, breaks = "Scott", labels = TRUE)
amHist(x = x, breaks = "Scott", main = "Histogram", ylab = "y-axis", xlab = "x-axis", col = "red")
amHist(x = x, breaks = "Scott", main = "Histogram",
       ylab = "y-axis", xlab = "x-axis", ylim = c(10, 15))
amHist(rnorm(100), breaks = "Scott", main = "Histogram",
       ylab = "y-axis", xlab = "x-axis")

Run the code above in your browser using DataLab