Labels under bins

Hi,

I was trying to plot a basic histogram in R using the hist() function, but even though the plot is correct, I can't seem to find how to add a name or label under each bin.

hist(gdppc$GDPPC,freq=TRUE, breaks=9)

Captura de Pantalla 2021-10-04 a les 16.38.36

I want each bin (rectangle) to have one number below each, instead of just three general ones (5000,10000,15000), because it does not even fit the plot that way.

Very thankful.

You can first draw the plot without any axes and then draw customized axes.

DF <- data.frame(N = runif(100, min = 0, max = 100))
#draw the plot with no axes
hist(DF$N, breaks = seq(0, 100, 10), axes = FALSE)
#draw the x axis (axis number 1) with defined tick marks
axis(1, at = seq(0,100, 10))
#draw the default y axis
axis(2)

Created on 2021-10-04 by the reprex package (v2.0.1)