I have a boxplot output in R using ggplot2:
p <- ggplot(data, aes(y = age, x = group))
p <- p + geom_boxplot()
p <- p + scale_x_discrete(name= "Group",)
p <- p + scale_y_continuous(name= "Age")
p
I need to add horisontal lines like on common boxplot (and to change vertical line style if possible):
boxplot(age~group,data=data,names=c('1','2'),ylab="Age", xlab="Group")
How I could do this using ggplot2?
Best Answer
Found solution myself. Maybe someone could use it:
The quantile data resulution is ugly, but works. Maybe there is another way. The result looks like this:
Also improved boxplot a little:
maybe this also could be useful to someone:
The result is:
and the same data with smaller range (boxplot
coef = 0.5
)