I’d like to put my own labels on a log-transformed y-axis of a boxplot:
with(TX, boxplot(b~tx, ylab="Biomass, g/m2, ln", yaxt="n", las=2, log="y", cex.axis=0.7))
The data:
pretty(log(TX$b))
[1] -6 -4 -2 0 2 4 6
length(levels(TX$tx))
[1] 22
I tried:
axis(2, at=pretty(log(TX$b)), labels=pretty(log(TX$b))) and
axis(2, at=c(-6, -3, -1, 0, 1, 3, 6), labels=c(-6, -3, -1, 0, 1, 3, 6)),
but in both cases only the positive values (and corresponding ticks!) are displayed. What’s the reason and how do I get this fixed?
You have transformed the y variable in the call to plot using
log = 'y'.This means you pass the
atcomponent as values on the untransformed scale.A reproducible example