View source: R/datalow_utils.r
addnorm | R Documentation |
addnorm - adds a normal distribution to a histogram of a data set. This is generally to be used to illustrate whether log-transformation normalizes a set of catch or cpue data.
addnorm(inhist, xdata, inc = 0.01)
inhist |
- is the output from a call to 'hist' (see examples) |
xdata |
- is the data that is being plotted in the histogram. |
inc |
- defaults to a value of 0.01; is the fine grain increment used to define the normal curve. The histogram will be coarse grained relative to this. |
a list with a vector of 'x' values and a vector of 'y' values (to be used to plot the fitted normal probability density function), and a vector used two called 'stats' containing the mean and sandard deviation of the input data
x <- rnorm(1000,mean=5,sd=1)
dev.new(height=6,width=4,noRStudioGD = TRUE)
par(mfrow= c(1,1),mai=c(0.5,0.5,0.3,0.05))
par(cex=0.85, mgp=c(1.5,0.35,0), font.axis=7)
outH <- hist(x,breaks=25,col=3,main="")
nline <- addnorm(outH,x)
lines(nline$x,nline$y,lwd=3,col=2)
print(nline$stats)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.