rAmCharts (version 2.1.15)

amHist: Plotting histogram

Description

amHist computes a histogram of the given data values.

Usage

amHist(x, ...)

# S3 method for numeric amHist( x, col = "#1e90ff", border = "#1e90ff", freq = TRUE, plot = TRUE, labels = FALSE, xlab, ylab, ylim, control_hist, ... )

Value

An object of class AmChart.

Arguments

x

numeric, a vector of values for which the histogram is desired.

...

see amOptions for more options.

col

character, a color to be used to fill the bars.

border

character, a color for the borders.

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). Defaults to TRUE if and only if breaks are equidistant (and probability is not specified).

plot

logical, if TRUE (default), an histogram is plotted, otherwise a list of breaks and counts is returned. In the second case, a warning is used if (typically graphical) arguments are specified that only apply to the plot = TRUE case.

labels

logical, set to TRUE to display labels. Default set to FALSE. Additionally draw labels on top of bars. if TRUE, draw the counts or rounded densities; if labels is a character, draw itself.

xlab, ylab

character, labels of the axis.

ylim

numeric, the range of y values with sensible defaults.

control_hist

(optional) named list() containing parameters to compute the histogram.

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
amHist(x = rnorm(100))

if (FALSE) {
# Other examples available which can be time consuming depending on your configuration.

x <- replicate(1000, {
if (round(runif(1))) {
  rnorm(1)
} else {
  rnorm(1, mean = 5)
}
})


# Without plot
amHist(x = x, plot = FALSE)

# With options
amHist(x = x, border = "blue")
amHist(x = x, col = "lightblue", control_hist = list(breaks = 100))
amHist(x = x, col = "grey")
amHist(x = x, col = "gray")
amHist(x = x, main = "Histogram", ylab = "y-axis", xlab = "x-axis", col = "red")
amHist(x = x, main = "Histogram", ylab = "y-axis", xlab = "x-axis", ylim = c(10, 15))
amHist(x = x, main = "Histogram", ylab = "y-axis", xlab = "x-axis")

# Options for computing the histogram
amHist(x = x, control_hist = list(breaks = "Scott"))
}

       

Run the code above in your browser using DataLab