Learn R Programming

berryFunctions (version 1.7.1)

normPlot: normal density plot

Description

nice plot of normal density distribution

Usage

normPlot(mean=0, sd=1, width=3, lines=TRUE, fill=rgb(0,0.3,0.8, 0.4),
cumulative=TRUE, las=1, 
main=paste("Normal density with\nmean =", signif(mean,2), "and sd =", signif(sd,2)),
ylim=lim0(y), ylab="", xlab="", type="l", lty=1, col=par("fg"), mar=c(2,3,3,3), ... )

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
fill
color passed to polygon. DEFAULT: rgb(0,0.3,0.8, 0.4)
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 plot and lines.
mar
margins for plot passed to par. DEFAULT: c(2,3,3,3)
...
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/web/packages/denstrip, http://cran.r-project.org/web/views/Distributions.html

Examples

Run this code
normPlot()
normPlot(81.7, 11.45)

Run the code above in your browser using DataLab