Home > Enterprise >  Why is `ann=FALSE` not working in the boxplot call in R?
Why is `ann=FALSE` not working in the boxplot call in R?

Time:07-22

Trying to produce both a stripchart and a boxplot of the same (transformed) data but (because the boxplot is shifted down a tad) I don't want the axis labels twice:

set.seed(3121975)
bee = list(x1=rnbinom(50, mu = 4, size = .1),  
           x2=rnbinom(30,mu=6,size=.1),  
           x3=rnbinom(40,mu=2,size=.1))
f = function(x) asinh(sqrt(4*x 1.5))
stripchart(lapply(bee,f),method="stack",offset=.13,ylim=c(.8,3.9))
boxplot(lapply(bee,f),horizontal=TRUE,boxwex=.05,at=(1:3)-.1,add=TRUE,ann=FALSE)

stripchart and boxplot overlaid, with two sets of axis labels

Other things that don't work include: (i) leaving ann to take its default value of !add, (ii) specifying labels for ylab.

I presume I have missed something obvious but I am not seeing what it might be.

CodePudding user response:

Just add yaxt = 'n' into boxplot() to suppress plotting of the y-axis. The argument ann controls axis titles and overall titles, not the axis itself.

enter image description here

  • Related