I want to use ggplot2
to create a histogram with variable binwidths. I have integer values (JR) from 1 to 46 in different frequencies. I would like to create classes of 4 values each, i.e. 1-4, 5-8, etc.. The histogram should show 11 bars. The first 10 bars have the same width (4 values) and the last bar must be somewhat wider (6 values: 40-46).
With geom_histogram
I can only creatz a histogram with equal bars. This works fine with binwidth=2
, but this is too small. Better is bindwith = 4
. But then the histogram starts with 2 on x-axis. It would help, when the x-Axis starts with 1.
ggplot(data, aes(JR)) + geom_histogram(aes(), binwidth=4)