Learn R Programming

berryFunctions (version 1.11.0)

normPlot: Normal density plot

Description

Nice plot of normal density distribution

Usage

normPlot(mean = 0, sd = 1, width = 3, lines = TRUE, quant = TRUE, fill = addAlpha("blue", c(2:6, 7:2)/10), cumulative = TRUE, las = 1, main = paste("Normal density with\nmean =", signif(mean, 2), "and sd =", signif(sd, 2)), ylim = lim0(dnorm(mean, mean, sd)), ylab = "", xlab = "", type = "n", lty = 1, col = par("fg"), mar = c(2, 3, 3, 3), keeppar = FALSE, ...)

Arguments

mean
average value as in dnorm. DEFAULT: 0
sd
standard deviation. DEFAULT: 1
width
distance (in sd) from plot ends to mean. DEFAULT: 3
lines
Should vertical lines be plotted at mean +- n*sd? DEFAULT: TRUE
quant
should quantile regions be drawn with fill colors? DEFAULT: TRUE
fill
color(s) passed to polygon. DEFAULT: addAlpha("blue",c(2:6,7:2)/10)
cumulative
Should cumulative density distribution be added? DEFAULT: TRUE
las
arguments passed to plot. DEFAULT: 1
main
main as in plot. DEFAULT: paste("Normal density with\nmean =", mean, "and sd =", sd)
ylim
limit for the y axis. DEFAULT: lim0(y)
ylab, xlab
labels for the axes. DEFAULT: ""
type, lty, col
arguments passed to lines. type="l" to add pdf line
mar
margins for plot passed to par. DEFAULT: c(2,3,3,3)
keeppar
should margin parameters be kept instead of being restored to previous value? DEFAULT: FALSE
...
further arguments passed to plot like lwd, xaxs, cex.axis, etc.

Value

None. Used for plotting.

Details

This function finds some nice defaults for very quickly plotting a normal distribution by just specifying mean and sd.

See Also

betaPlot, dnorm, http://cran.r-project.org/package=denstrip, http://cran.r-project.org/web/views/Distributions.html

Examples

Run this code

normPlot()
normPlot(81.7, 11.45)
normPlot(180, 11, quant=FALSE, width=2)

Run the code above in your browser using DataLab