Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing top and right borders from boxplot frame in R

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!

like image 900
user3431483 Avatar asked Mar 18 '14 04:03

user3431483


2 Answers

  1. Plot without axes
    boxplot(x, axes=F)
  1. Add a box of type "l" (that's an L, not a 1), like thelatemail suggested
    box(bty="l")
  1. Add axis ticks at desired values.
    axis(2)
    axis(1) #if you really want x-axis ticks here...

enter image description here

like image 52
Poquontchn Avatar answered Oct 07 '22 21:10

Poquontchn


I think you need to use axis(side=1) after plotting.

x <- 1:5
boxplot(x, frame.plot = FALSE)
axis(side = 1)

This gives

enter image description here

like image 41
CHP Avatar answered Oct 07 '22 22:10

CHP