I am trying to show the median value(i.e the horizontal bar) in the a box plot by using ggplot(). R keeps asking to specify y axis. I am a bit stuck.
p <-
I don't think that stat_bin
is the way to go:
library(plyr)
library(ggplot2)
p_meds <- ddply(p, .(TYPE), summarise, med = median(TOTALREV))
ggplot(p,aes(x = TYPE, y = TOTALREV)) +
geom_boxplot() +
geom_text(data = p_meds, aes(x = TYPE, y = med, label = med),
size = 3, vjust = -1.5)
As a side note, I generally find that people are less confused with ggplot once they learn to stop using qplot
.