[R] boxplot strange behavior

Dennis Murphy djmuser at gmail.com
Wed Nov 16 20:46:01 CET 2011


And you got a reply on the ggplot2 list, which is why you're asked not
to cross-post.

For those who are wondering, geom_boxplot() in the ggplot2 package
will by default plot outside points along the same line as the boxplot
whiskers at their actual values. The gentleman jittered the original
points in a separate call to geom_point(), so the result is that the
outside points are plotted twice - once along the whisker lines (in
black) from geom_boxplot() and once as jittered points with alpha
transparency from geom_point(). Since jitter can be positive or
negative in either the horizontal direction, confusion ensues...

Dennis

On Wed, Nov 16, 2011 at 11:16 AM, Giovanni Azua
<azuagarg at student.ethz.ch> wrote:
> Hello,
>
> I generate box plots from my data like this:
>
> qplot(x=xxx,y=column,data=data,geom="boxplot") + xlab("xxx") + ylab(ylabel) + theme_bw() + scale_y_log10() + geom_jitter(alpha=I(1/10))
>
> The problem is that I see lot of points above the maximum at the same level as some outliers. It looks very weird as I expected the outliers to be "few" and specially not see any points other than the outliers below the minimum or above the maximum indicator. Can anyone explain what's going on?
>
> Attached I send a snapshot, see the second level having some outliers, separate from the outliers there are also some points which seem not to be outliers and that are above the maximum indicator? is this a bug or am I missing anything?
>
> TIA,
> Best regards,
> Giovanni
>
> PS: I sent this to the ggplot2 list too (sorry for the double post but I am kind of under pressure with this)
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list