[R] trying to superimpose a line plot onto a histogram

Edwin Lei unlucky24 at hotmail.com
Sat Jul 5 09:26:08 CEST 2008


I'm trying to superimpose a line plot onto a histogram but I'm not having
any luck. I've attached the dataset. What I did was:

> hist(data,freq=F)

Now I'm trying to superimpose the following points with a line connecting
them onto the histogram:

 x            y
100  0.535665393824959
200  0.212744329736556
300  0.0844933242968584
400  0.0335572838043417
500  0.0133275771274986
600  0.00529316714442912
700  0.0021022289461042
800  0.000834919136549392
900  0.000331595645597124
1000 0.000131696193518099
1100 5.2304327929049e-05
1200 2.07731343406939e-05

Basically, the x values correspond to the break points in the histogram.
Next I used the command

> points(x,y,type="l")

But for some reason, the line plot is shifted to the right and doesn't line
up with the histogram.

Thanks for the help!

Edwin Lei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: data.pdf
Type: application/pdf
Size: 10527 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080705/650a4e57/attachment.pdf>

More information about the R-help mailing list