[Rd] boxplot() confuses x- and y-axes (PR#10345)

bob.ohara at helsinki.fi bob.ohara at helsinki.fi
Mon Oct 15 10:30:05 CEST 2007


Full_Name: Bob O'Hara
Version: 2.6.0
OS: Windows XP
Submission from: (NULL) (88.112.20.250)


Using horizontal=TRUE with boxplot() confuses it as to what is an x- or y-axis. 
At least, xlim= and ylim= are the wrong way round, log="x" (or "y") and xaxt=
work as expected, I haven't looked at anything else.

Some code to see if you can reproduce the bug (or discover it's in my head...):

boxplot(count ~ spray, data = InsectSprays)

# Try to change x-axis:
boxplot(count ~ spray, data = InsectSprays, xlim=c(0,50))

# Plot horizontally:
boxplot(count ~ spray, data = InsectSprays, horizontal=TRUE)

# Now try to change x-axis:
boxplot(count ~ spray, data = InsectSprays, horizontal=TRUE, xlim=c(0,50))
# Changes y-axis!

# Now try to change y-axis:
boxplot(count ~ spray, data = InsectSprays, horizontal=TRUE, ylim=c(0,50))
# Changes x-axis!

# Plot x-axis on log scale:
boxplot(count+1 ~ spray, data = InsectSprays, horizontal=TRUE, log="x")
# Does indeed change x-axis

# Don't add ticks on x-axis:
boxplot(count ~ spray, data = InsectSprays, horizontal=TRUE, xaxt="n")
# Works as expected.



More information about the R-devel mailing list