
Last chance! 50% off unlimited learning
Sale ends in
Create histograms and hollow histograms. This function permits easy color and appearance customization.
histPlot(x,
col = fadeColor("black", "22"), border = "black",
breaks = "default", probability = FALSE,
hollow = FALSE, add = FALSE, lty = 2, lwd = 1,
freqTable=FALSE, right=TRUE, axes = TRUE,
xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL,
...)
Numerical vector or a frequency table (matrix) where the first column represents the observed values and the second column the frequencies. See also freqTable
argument.
Shading of the histogram bins.
Color of histogram bin borders.
A vector for the bin boundaries or an approximate number of bins.
If FALSE
, the frequency is plotted. If TRUE
, then a probability density.
If TRUE
, a hollow histogram will be created.
If TRUE
, the histogram is added to the plot.
Line type. Applies only if hollow=TRUE
.
Line width. Applies only if hollow=TRUE
.
Set to TRUE
if x
is a frequency table.
Set to FALSE
to assign values of x
that fall on a bin margin to the left bin. Otherwise the ties default to the right bin.
If FALSE
, the axes are not plotted.
Label for the x axis.
Label for the y axis.
Limits for the x axis.
Limits for the y axis.
Additional arguments to plot
. If add
is TRUE
, these arguments are ignored.
# NOT RUN {
data(run10)
par(mfrow=c(2,2))
histPlot(run10$time)
histPlot(run10$time[run10$gender=='M'], probability=TRUE, xlim=c(30, 180),
ylim=c(0, 0.025), hollow=TRUE)
histPlot(run10$time[run10$gender=='F'], probability=TRUE, add=TRUE,
hollow=TRUE, lty=3, border='red')
legend('topleft', col=c('black', 'red'), lty=2:3, legend=c('M','F'))
histPlot(run10$time, col=fadeColor('yellow', '33'), border='darkblue',
probability=TRUE, breaks=30, lwd=3)
brks <- c(40, 50, 60, 65, 70, 75, 80, seq(82.5, 120, 2.5), 125,
130, 135, 140, 150, 160, 180)
histPlot(run10$time, probability=TRUE, breaks=brks,
col=fadeColor('darkgoldenrod4', '33'))
# }
Run the code above in your browser using DataLab