In using the error.bars.by() function in the psych package in R, when bars=TRUE, the bars are drawn incorrectly on the chart. The bars base is below the x-axis and overwrites the x-axis labels. Does anyone know of setting, fix, or workaround for this? I tried specifying ylim = c(1,2) but this did not help.
library(psych)
y <- abs(rnorm(1:100))
i <- rep(1:2, 50)
error.bars.by(y , i, bars=TRUE ) # Bottom of bars on x-axis
error.bars.by(y+1, i, bars=TRUE ) # Bottom of bars below x-axis
You can use the xpd
option of barplot
:
set.seed(1)
y <- abs(rnorm(1:100))
i <- rep(1:2, 50)
error.bars.by(y+1, i, bars=TRUE, ylim=c(1, 3), xpd=FALSE)