[R] How to plot distribution of relative frequncy using ggplot2?

vod vos vodvos at zoho.com
Sat Feb 25 17:21:12 CET 2017

Hello everyone,

How to plot distribution of relative frequncy using ggplot2 ? The example figure is in the attachment.

If we have data:

aa<- c(1,5,10,20,50,40,50,60,70,80,90,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000)

bb<- c(8,16,30,24,39,54,40,68,72,62,122,80,181,259,275,380,320,434,479,587,626,648,738,766,793,851,871,957,1001,960)

aabbdiff<- aa-bb

aabb<- data.frame(aa, bb, aabbdiff)


ggplot(aabb, aes(aabbdiff)) + geom_histogram() 

The above code line did not show what I want, how to draw the figure like in the attachment?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: geom.png
Type: image/png
Size: 73608 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20170225/f3386505/attachment.png>

More information about the R-help mailing list