Does anyone know how to remove the top and right borders of the boxplot frame in R? I have tried the argument frame=FALSE but that removes all sides but the left side(y-axis). I just want the x-axis and y-axis to display.
Thanks in advance!
Does anyone know how to remove the top and right borders of the boxplot frame in R? I have tried the argument frame=FALSE but that removes all sides but the left side(y-axis). I just want the x-axis and y-axis to display.
Thanks in advance!
I think you need to use axis(side=1)
after plotting.
x <- 1:5
boxplot(x, frame.plot = FALSE)
axis(side = 1)
This gives
boxplot(x, axes=F)
box(bty="l")
axis(2)
axis(1) #if you really want x-axis ticks here...
To remove ticks, you need to specify the ticks line width as zero (lwd.ticks=0). To ensure the x and y axes meet is a bit more laborious, you need to
Putting that all together for the example above:
x <- 1:5
boxplot(x, frame.plot = FALSE,ylim=c(0,5))
axis(side=1, pos=0, lwd.ticks=0)
abline(h=0)
abline(h=0, lwd = 1.5)
–
Taciturn © 2022 - 2024 — McMap. All rights reserved.
box(bty="l")
once you have usedframe=FALSE
– Christmastide