amHist: Plotting histogram

Description Usage Arguments Value References See Also Examples

View source: R/chart_amHist.R

Description

amHist computes a histogram of the given data values.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
amHist(x, ...)

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

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.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
amHist(x = rnorm(100))


# 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"))


       

rAmCharts documentation built on Dec. 6, 2019, 5:11 p.m.

Related to amHist in rAmCharts...