I find histograms by graphics or ggplot2 lacks some columns ought to be shown.
Is this a bug of graphic device?
Is there any way to work around?
I found the problem is reproducible when
- Bins with 0 counts exist between bins with non-zero counts.
- Size of graphic device is not large enough
set.seed(1) x <- rpois(1e4, 1000) * 2
library(ggplot2) ggplot(data.frame(x = x), aes(x)) + geom_histogram(binwidth = 1)
300 x 300 pixels
600 x 300 pixels
hist(x, breaks = 1700:2300, col = "black", border = "transparent")
500 x 300 pixels