geom_histogram function in r code example Example: geom_histogram r ggplot(diamonds, aes(x = price)) + geom_histogram(binwidth = 1000)