Nice plot of normal density distribution
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,
...
)
None. Used for plotting.
average value as in dnorm
. DEFAULT: 0
standard deviation. DEFAULT: 1
distance (in sd) from plot ends to mean. DEFAULT: 3
Should vertical lines be plotted at mean +- n*sd? DEFAULT: TRUE
should quantile regions be drawn with fill
colors? DEFAULT: TRUE
color(s) passed to polygon
. DEFAULT: addAlpha("blue",c(2:6,7:2)/10)
Should cumulative density distribution be added? DEFAULT: TRUE
arguments passed to plot
. DEFAULT: 1
main as in plot
. DEFAULT: paste("Normal density with\nmean =", mean, "and sd =", sd)
limit for the y axis. DEFAULT: lim0(y)
labels for the axes. DEFAULT: ""
arguments passed to lines
. type="l" to add pdf line
margins for plot passed to par
. DEFAULT: c(2,3,3,3)
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.
Berry Boessenkool, berry-b@gmx.de, July 2014
This function finds some nice defaults for very quickly plotting a normal distribution by just specifying mean and sd.
normPlot()
normPlot(81.7, 11.45)
normPlot(180, 11, quant=FALSE, width=2)
Run the code above in your browser using DataLab