[Rd] Barplot & Boxplot: lim and horizontal

Colin Gillespie c@g|||e@p|e @end|ng |rom gm@||@com
Fri May 17 11:56:50 CEST 2019


Dear All,

I've noticed an inconsistency between boxplot & barplot regarding the
interaction between
switching to a horizontal graph and the limits.

par(mfrow = c(2, 2))
boxplot(1:10, xlim = c(0.1, 5), ylim = c(1, 10),
              log = "y", horizontal=FALSE, xlab = "X", ylab = "Y")
axis(1)
# Changing to horizontal, xlim <-> ylim
# log = y is still the y-axis. ylab is still the y-axis
boxplot(1:10, xlim = c(0.1, 5), ylim = c(1, 10), log = "y",
                       horizontal=TRUE, xlab = "X", ylab = "Y")
axis(2)

barplot(2, xlim = c(0.1, 5), ylim = c(0.1, 10),
                  log = "y", horiz=FALSE, xlab = "X", ylab = "Y")
axis(1)
# Changing to horizontal, xlim still refers to xlim
# log = y is still the y-axis. ylab is still the y-axis
barplot(2, xlim = c(0.1, 5), ylim = c(0.1, 10), log = "y",
                horiz=TRUE, xlab = "X", ylab = "Y")
axis(2)

Thanks

Colin



More information about the R-devel mailing list