Learn R Programming

mosaic (version 0.2-3)

xtras: Augmented lattice functions

Description

These functions all behave similarly to the functions with the initial x removed from their names.

Usage

xhistogram(x, data=NULL, panel=panel.xhistogram, type="density", ...)

xqqmath(x, data=NULL, panel="panel.xqqmath", ...)

panel.xqqmath(x, qqmathline = !(fitline || idline), idline = FALSE, fitline = FALSE, slope = NULL, intercept = NULL, overlines = FALSE, groups=NULL, ..., col.line = trellis.par.get("add.line")$col, pch = 16, lwd = 2, lty = 2 )

panel.xhistogram(x, dcol = trellis.par.get("plot.line")$col, dlwd = 2, gcol = trellis.par.get("add.line")$col, glwd = 2, fcol = trellis.par.get("superpose.polygon")$col, dmath = dnorm, verbose = FALSE, dn = 100, args = NULL, labels = FALSE, density = FALSE, fit = NULL, start = NULL, type = "density", v, h, groups=NULL, breaks, stripes=c('vertical','horizontal','none'), alpha=1, ...)

Arguments

data
a data frame.
density
boolean -- should a density curve be overlaid on histogram?
dmath
density function, defaults to dnorm
dn
an integer indicating the resolution to use for plotting the density curve
args
a list of arguments passed to dmath
v, h
numerical vector of positions for vertical and horizontal lines to add to plot
breaks
break points for histogram bins
stripes
type of stripes to use for grouping in histograms
alpha
opacity value for histogram rectangles
panel
a panel function
x
A numeric vector or formula.
overlines
boolean. If TRUE, place lines above the data, otherwise lines are below (default).
idline
boolean. If TRUE, add the line with slope 1 and intercept 0 to the plot.
qqmathline
boolean. If TRUE, add a line using panel.qqmathline
fitline
boolean. If TRUE, add a line to the plot, using slope and intercept given by slope and intercept.
slope
slope for fitline. If NULL (the default) the mean of the data is used, which works well for normal-quantile plots but may not be what you want for fitting other distributions.
intercept
intercept for fitline. If NULL (the default), the standard deviation of the data is used, which works well for normal-quantile plots but may not be what you want for fitting other distributions.
col.line
like col but applied only to lines
lwd,lty
line width and line type
dcol, dlwd
like col and lwd but applied to density curves
gcol, glwd
like col and lwd but applied to grid lines
fcol
fill color for histogram rectangles
fit
passed to fitdistr from MASS for maximum-likelihood fitting
verbose
a logical indicating whether verbose output should be displayed
groups
grouping variable as in other lattice plots
pch
plot character as in other lattice plots
type
type of histogram
labels
a logical indicating whether labels be added to histogram
start
starting point for use by fitdistr
...
other arguments including q, p, which, main which behave as in other lattice graphics functions

See Also

histogram, pnorm, qnorm, qqmath, and plot.

Examples

Run this code
x <- rnorm(200)
xhistogram(~ x, groups = x > 2, n=20, density=TRUE )

Run the code above in your browser using DataLab