I have the following data
dati <- read.table(text="
class num
1 0.0 63530
2 2.5 27061
3 3.5 29938
4 4.5 33076
5 5.6 45759
6 6.5 72794
7 8.0 153177
8 10.8 362124
9 13.5 551051
10 15.5 198634
")
And I want to produce a histogram with variable size bins, so that the area of each bar reflects the total numerosity (num) of each bin. I tried
bins <- c(0,4,8,11,16)
p <- ggplot(dati) +
geom_histogram(aes(x=class,weight=num),breaks = bins)
however, this produces a histogram where the length of each bar is equal to total numerosity of each bin. Because bin widths are variable, areas are not proportional to numerosity. I could not solve this apparently easy problem within ggplot2. Can anyone help me?

