On 09/23/2010 05:42 PM, "Sibylle Stöckli" wrote:
Dear R-users
Idea:
Plot a dnorm line using specific mean/sd to complete a histogram (skewed).
xs:range of y-values, ys: dnorm function
Problem:
I expected to multiply the ys function with the sample size (n=250-300). I was
wondering about a factor between 12'000 and 30'000 to match the size of the
dnorm line with the specific histogram.
Thanks
Sibylle
hist(Biotree[Ld,]$Height2008, main="Larix decidua", ylim=c(0,50), xlab="Tree Height 2008
(cm)",col="aquamarine", font.main=3, cex.axis=0.8)
xs<-0:650
ys<-dnorm(xs, mean=397.8, sd=97.6)
lines(xs,ys*12000)
Hi Sibylle,
You can use one of the "rescale" functions (one is in the plotrix
package) like this:
Ld.hist<-hist(Biotree[Ld,]$Height2008, main="Larix decidua",
ylim=c(0,50), xlab="Tree Height 2008 (cm)",
col="aquamarine", font.main=3,cex.axis=0.8)
xs<-0:650
ys<-dnorm(xs, mean=397.8, sd=97.6)
lines(xs,rescale(ys,0:max(Ld.hist)))
Jim
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.