Re: [R] Need help with boxplots
To prevent confusion you might want to use a red dot rather than a line: points(1:2, c(mean(a), mean(b)), col = red) and perhaps label it since its non-standard: text(1:2, c(mean(a), mean(b)), Mean, pos = 4) On 9/26/06, laba diena [EMAIL PROTECTED] wrote: How to add a mean line in the boxplot keeping the median line ? For example in this: set.seed(1) a - rnorm(10) b - rnorm(10) boxplot(a, b) [[alternative HTML version deleted]] __ 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. __ 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.
Re: [R] Need help with boxplots
The problem with a line, I think, would be that the width of the boxes can vary depending on the number of boxes in the plot, etc. No doubt it could be done, but you'd probably have to look into the bxp function to see how the widths are calculated. On 26/09/06, laba diena [EMAIL PROTECTED] wrote: How to add a mean *line* in the boxplot keeping the median line ? Maybe it is possible to do using the *segments* function ? For example in this: set.seed(1) a - rnorm(10) b - rnorm(10) boxplot(a, b) [[alternative HTML version deleted]] __ 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. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ 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.
Re: [R] Need help with boxplots
And if you really do want a line segment try this: M - c(mean(a), mean(b)) segments(1:2-0.4, M, 1:2+0.4, M, col = red) On 9/26/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: To prevent confusion you might want to use a red dot rather than a line: points(1:2, c(mean(a), mean(b)), col = red) and perhaps label it since its non-standard: text(1:2, c(mean(a), mean(b)), Mean, pos = 4) On 9/26/06, laba diena [EMAIL PROTECTED] wrote: How to add a mean line in the boxplot keeping the median line ? For example in this: set.seed(1) a - rnorm(10) b - rnorm(10) boxplot(a, b) [[alternative HTML version deleted]] __ 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. __ 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.