Thanks Jim.. once again your rock




On Wednesday, January 22, 2014 9:51 AM, Jim Lemon <j...@bitwrit.com.au> wrote:
 
On 01/22/2014 07:37 PM, Alaios wrote:

> Hi there,
> I would like to be able to draw a density plot or a box plot where the median 
> and the median and the mean would be visible.
>
> If I decide a density plot I need to put two big marks one for the median and 
> one for the mean, which I do not know how I can achieve to put marks in a 
> density plot. For that I am using plot(density(myVector))
>
> while on the boxplot median is already visible but mean not. To have the mean 
> there I would have to add one more line on each boxplot, perhaps of different 
> color but I am not sure if that is possible in R. boxplot(myVector) I am using
>
> where myVector can be something like myVector<-seq(1,200)
>
Hi Alex,
On a density plot you can use abline:

abline(v=mean(myVector),col="red")
abline(v=median(myVector),col="green")

I don't know of any boxplot function that will plot two measures of 
central tendency, but box.heresy in plotrix will plot any one measure 
that you like.

Jim
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to