It is not clear what curve you want to plot, but this code may help get you started (the final plot will probably need the x and y limits expanded and maybe other options changed):
x <- rnorm(100, rep( c(100,105), c(75,25)), 2 ) hist(x, probability=TRUE) lines( density(x), col='green' ) curve( dnorm(x, mean=mean(x), sd=sd(x)), col='blue', add=TRUE ) see the help for hist, lines, and curve for details. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of leo_wa > Sent: Monday, October 20, 2008 8:47 PM > To: r-help@r-project.org > Subject: [R] how to plot the histogram and the curve in the same graph > > > i want to plot the histogram and the curve in the same graph.if i have > a set > of data ,i plot the histogram and also want to see what distribution it > was.So i want to plot the curve to know what distribution it like. > -- > View this message in context: http://www.nabble.com/how-to-plot-the- > histogram-and-the-curve-in--the-same-graph-tp20082506p20082506.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. ______________________________________________ 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.