Quantcast

mean in the boxplot

classic Classic list List threaded Threaded
3 messages Options
yan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

mean in the boxplot

yan
Dear R users,

How to show mean in the boxplot instead of median ?

Many thanks

Yan

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mean in the boxplot

David Winsemius

On Apr 1, 2011, at 1:20 PM, Yan Jiao wrote:

> Dear R users,
>
> How to show mean in the boxplot instead of median ?

Read ... help(boxplot)

Use boxplot to create a set of values, substitute th emean for the  
groups then pass the mangled set of values to bxp().

--

David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mean in the boxplot

Peter Ehlers
On 2011-04-01 10:28, David Winsemius wrote:

>
> On Apr 1, 2011, at 1:20 PM, Yan Jiao wrote:
>
>> Dear R users,
>>
>> How to show mean in the boxplot instead of median ?
>
> Read ... help(boxplot)
>
> Use boxplot to create a set of values, substitute th emean for the
> groups then pass the mangled set of values to bxp().
>

Another option is to add the means as points after
plotting the boxplot with:

   boxplot(....)
   points(1:n, Means)

This is particularly useful if you want both the
medians and the means on the plot. If you don't
want the median line, you can get rid of it by
setting medcol="transparent" in the boxplot() call.

But then again, the whole point of a boxplot is to
represent general distributional shape for which
the median is surely more effective.

Peter Ehlers

______________________________________________
[hidden email] 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.
Loading...