Hi all, I attach a picture, with my output plot. I put this command to obtain it: hist(MCT[,2],probability=TRUE,xlab=" ",ylab="Max",main="M distribution") lines(density(MCT[,2]), lwd = 2) The problem is that when I extract the "bell" is too high? And the higher part doesn?t appear in the plot. There is some trick to adjust the line on the plotted area? -------------- next part -------------- A non-text attachment was scrubbed... Name: Rplotdddd.png Type: image/png Size: 11755 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121117/80b834cc/attachment-0002.png>
On 12-11-17 5:38 AM, bgnumis wrote:> Hi all, > > I attach a picture, with my output plot. > > I put this command to obtain it: > > hist(MCT[,2],probability=TRUE,xlab=" ",ylab="Max",main="M distribution") > lines(density(MCT[,2]), lwd = 2) > > The problem is that when I extract the "bell" is too high? And the higher > part doesn?t appear in the plot. There is some trick to adjust the line on > the plotted area? >You need to set ylim in your call to hist(). You can do it by trial and error, or compute the numbers first via h <- hist(MCT[,2], plot=FALSE) and set ylim <- range(c(0, h$density, density(MCT[,2])$y)) before you plot: hist(MCT[,2], probability=TRUE, ylim=ylim, xlab=" ", ylab="Max", main="M distribution") lines(density(MCT[,2]), lwd = 2) Duncan Murdoch
On 11/17/2012 4:38 AM, bgnumis wrote:> Hi all, > > I attach a picture, with my output plot. > > I put this command to obtain it: > > hist(MCT[,2],probability=TRUE,xlab=" ",ylab="Max",main="M distribution") > lines(density(MCT[,2]), lwd = 2) > > The problem is that when I extract the "bell" is too high? And the higher > part doesn´t appear in the plot. There is some trick to adjust the line on > the plotted area? >Use the ylim= argument of hist to change the y scale ?hist Perhaps, ylim = range(density(MCT[,2]), But without data and a full working example I couldn't test it. Rob> > > ______________________________________________ > 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.-- __________________ Robert W Baer, Ph.D. Professor of Physiology Kirksville College of Osteopathic Medicine A. T. Still University of Health Sciences Kirksville, MO 63501 US [[alternative HTML version deleted]]