I am using ggplot2
to draw a histogram of a sample of size 1000 taken from a normal distribution. I need to place the letter 'A' on the center of the histogram, and doing that with the function annotate
.
Since this vector is random, the "center" of the drawing will change a little bit every time I run the code so I need to find a way in which the function knows how to place the 'A' according to that specific sample.For the x axis I took the median of the sample for the Y axis i was thinking of taking the frequency of the most frequent bin and dividing by 2.
Does anybody know if there is a function who gives you the frequency of each bin?
Here is a reproducible example:
library(ggplot2)
set.seed(123)
x <- rnorm(1000)
qplot(x, geom="histogram")