normalHist generates a histogram with a density curve and a normal density curve.
normalHist(
vector,
histColor = "#0000CC",
distributionColor = "#0000CC",
normalColor = "#00CC00",
distributionLineSize = 1,
normalLineSize = 1,
histAlpha = 0.25,
xLabel = NULL,
yLabel = NULL,
normalCurve = TRUE,
distCurve = TRUE,
breaks = 30,
theme = ggplot2::theme_minimal(),
rug = NULL,
jitteredRug = TRUE,
rugSides = "b",
rugAlpha = 0.2,
returnPlotOnly = FALSE
)
# S3 method for normalHist
print(x, ...)
A numeric vector.
The colour to use for the histogram.
The colour to use for the density curve.
The colour to use for the normal curve.
The line size to use for the distribution density curve.
The line size to use for the normal curve.
Alpha value ('opaqueness', as in, versus transparency) of the histogram.
Label to use on x axis.
Label to use on y axis.
Whether to display the normal curve.
Whether to display the curve showing the distribution of the observed data.
The number of breaks to use (this is equal to the number of bins minus one, or in other words, to the number of bars minus one).
The theme to use.
Whether to add a rug (i.e. lines at the bottom that correspond to individual datapoints.
Whether to jitter the rug (useful for variables with several datapoints sharing the same value.
This is useful when the histogram will be rotated; for example, this can be set to 'r' if the histogram is rotated 270 degrees.
Alpha value to use for the rug. When there is a lot of overlap, this can help get an idea of the number of datapoints at 'popular' values.
Whether to return the usual normalHist
object
that also contains all settings and intermediate objects, or whether to only
return the ggplot2::ggplot()
plot.
The object to print.
Any additional arguments are passed to the default print
method.
An object, with the following elements:
The input when the function was called.
The intermediate numbers and distributions.
The dataframe used to generate the plot.
The histogram.
normalHist(mtcars$mpg)