[R] [BUG] or [undocumented] boxplot - horizontal swaps ylim and xlim

S Ellison S.Ellison at LGCGroup.com
Fri Feb 13 14:30:32 CET 2015


> When using the function boxplot() together with the argument
> | horizontal = TRUE
> xlim and ylim become swapped, i.e. ylim refers to the x-axis instead of the y-
> axis:

It is neither a bug nor undocumented, though the documentation is a not in ?boxplot (because xlim and ylim aren't defined there) and is also tad unclear in the present version.

For boxplot and its methods, xlim and ylim fall into '...', which is (as documented) passed to bxp (see boxplot.default).
?bxp, says:

"pars,...: graphical parameters (etc) can be passed as arguments to this
          function, either as a list ('pars') or normally('...'), see
          the following.  (Those in '...' take precedence over those in
          'pars'.)

          Currently, 'yaxs' and 'ylim' are used 'along the boxplot',
          i.e., vertically, when 'horizontal' is false, and 'xlim'
          horizontally.  'xaxt', 'yaxt', 'las', 'cex.axis', and
          'col.axis' are passed to 'axis', and 'main', 'cex.main',
          'col.main', 'sub', 'cex.sub', 'col.sub', 'xlab', 'ylab',
          'cex.lab', and 'col.lab' are passed to 'title'."

The key phrase is "Currently, 'yaxs' and 'ylim' are used 'along the boxplot',"     

S Ellison



*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list