[Rd] Behavior of ylim in boxplot() when horizontal=TRUE

Viechtbauer, Wolfgang (NP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Thu Jun 9 13:03:10 CEST 2022

Hi all,

I just noticed something when using boxplot(). Say we have this boxplot:

boxplot(mpg ~ cyl, data=mtcars, xlab="Cylinders", ylab="Miles per Galon", ylim=c(10,40), log="y")

ylab, ylim, and log="y" are all consistently adjusting things on the y-axis (the numeric 'outcome' variable).

Now let's use horizontal=TRUE:

boxplot(mpg ~ cyl, data=mtcars, las=1, xlab="Miles per Galon", ylab="Cylinders", horizontal=TRUE, ylim=c(10,40), log="x")

Now xlab and log="x" are used to adjust things on the x-axis, but ylim still needs to be used to adjust the range of the numeric 'outcome' variable. Not a big deal, but this seems a bit inconsistent.


More information about the R-devel mailing list