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)
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.
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)