Re: [R] abline plots at wrong abscissae after boxplot

From: S Ellison <S.Ellison_at_lgc.co.uk>
Date: Fri, 22 Jun 2007 12:49:38 +0100


Boxplot positions and labels are not the same thing. You have groups 'called' "2", "3", "4". As factors - which is what bocplot will turn them into - they will be treated as arbitrary labels and _numbered_ 1:3 (try as.numeric(factor(x)).

So your lm() used 2:4, but your plot (and abline) uses 1:3 for positions and "2" - "4" as labels.

The best option used to be to plot the boxes at positions 2:4. Look at the at= parameter in boxplot. But that is now of little help because there is no way of overriding xlim, leaving you no alternative but to reformulate your model with an offset or something.

I will take up the boxplot xlim issue separately on R-dev; it's not the only such.

Steve Ellison.

>>> "Brian Wilfley" <bwilfley_at_tripleringtech.com> 21/06/2007 22:44:17 >>>
I'm trying to add lines to a plot originally made with "boxplot", but the lines appear in the wrong place.



This email and any attachments are confidential. Any use, co...{{dropped}}

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 and provide commented, minimal, self-contained, reproducible code. Received on Fri 22 Jun 2007 - 12:19:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 22 Jun 2007 - 12:32:13 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.