[R] horizontal lines on stripchart

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Sep 17 14:05:48 CEST 2005


Iain Gallagher wrote:
> Hi.
> 
> I would like to add a horizontal line to each column of data on a 
> stripchart (vertical=T) to indicate the mean(rather like the package 
> Prism does - for those that have used this) for each dataset. I presume 
> the best way to do this would be with "lines" but after much trying  / 
> playing about I can't figure it out. Can anyone help?
> 
> Thanks
> 
> ______________________________________________
> R-help at 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




Example adapted from ?stripchart:



with(OrchardSprays, {
     stripchart(decrease ~ treatment,
         main = "stripchart(Orchardsprays)", ylab = "decrease",
         vertical = TRUE)
     m <- tapply(decrease, treatment, mean)
     segments(1:nlevels(treatment)-0.25, m, 1:nlevels(treatment)+0.25, m)
})


Uwe Ligges




More information about the R-help mailing list