Re: [R] Labelling boxplot with fivenumber summary

From: jim holtman <jholtman_at_gmail.com>
Date: Fri 06 Apr 2007 - 17:02:14 GMT

Here is one way of labeling the values:

# capture data returned by boxplot
x <- boxplot(count ~ spray, data = InsectSprays, col = "lightgray") # plot each group
for (i in seq(ncol(x$stats))){

    text(i, x$stats[,i], labels=x$stats[,i]) }
# if there are outliers, plot them
if (length(x$out) > 0){

    # split the groups so you can get max/min     maxmin <- split(x$out, x$group)
    # go through each group getting min/max     lapply(names(maxmin), function(.grp){

        .range <- range(maxmin[[.grp]])
        text(as.numeric(.grp), .range, labels=.range)
    })
}

On 4/6/07, Daniel Siddle <sidds13@hotmail.com> wrote:
>
> I am very new to R so forgive me if this seems basic but I have done extensive searching and failed to come up with the answer for myself.
>
> I am trying to label a boxplot I have created with the values for the median, upper and lower quartiles and max and min values. I have been unable to do this or find anything on the net to say how it might be done. Is this possible and if so how? Regards,
>
> Daniel Siddle
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help@stat.math.ethz.ch 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.
Received on Sat Apr 07 03:14:47 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 06 Apr 2007 - 19:30:56 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.