4
As far as I know, more advanced graphic packages from R
, as lattice
and ggplot2
, do not have an easy way to place numbers on top of histogram bars. I imagine it can be done, but it’s a pretty big job, just to discourage this use. This is due to the fact that almost no one currently thinks that histograms need to be accompanied by numbers. Graphics should be as clean as possible, so that they, and only they, can pass on all the necessary information to the reader. Especially if the histogram has many categories, the visual is extremely impaired if each column is accompanied by a number. If the use of numbers is essential, the suggestion is to use a table. It is more elegant.
That said, the function hist
of R
, for being written long ago, it has an easy way to add numbers to the histograms. Simply add the argument labels=TRUE
to your call:
hist(cars$speed, labels=TRUE)
Edit the question with examples of data and the code that produced the chart, please. For the data, it is best to post the output of
dput(dados)
or, ifdados
is too big,dput(head(dados, 20))
.– Rui Barradas