r - Equivalent of 'range' in boxplot for ggplot2 -
i trying whiskers of ggplot2's geom_boxplot cover outliers. outliers de facto not displayed dots encompassed boxplot.
if using standard 'boxplot', using:
boxplot(x, range=n)
where n large number that, instead of displaying outliers, boxplots's whiskers extend cover outliers.
how can done ggplot2? i've tried:
ggplot(mydf, aes(x=x, y=y)) + geom_boxplot(range = 5)
note: not want discard outliers using like:
geom_boxplot(outlier.shape = na)
the way know of compute box values this:
library(plyr) xx <- ddply(mtcars,.(cyl), transform, ymin = min(mpg), ymax = max(mpg), middle = median(mpg), lower = quantile(mpg,0.25), upper = quantile(mpg,0.75)) ggplot(data = xx,aes(x = factor(cyl))) + geom_boxplot(aes(ymin = ymin,ymax = ymax,middle = middle,upper = upper,lower= lower), stat = 'identity')
there warnings on ddply
call, should able ignore them safely.
Comments
Post a Comment