Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing the frame from the Boxplot() function in R

Tags:

r

boxplot

Does someone know how to remove the frame when producing a boxplot with the R boxplot() function?

With the plot() function there is an optinal argument, frame=F, that does the job... but it is not included in the boxplot() function...

Thank you very much!

like image 242
Marco Avatar asked Feb 09 '11 14:02

Marco


People also ask

What is the Boxplot function in R?

Data Visualization using R Programming Boxplots are a measure of how well distributed is the data in a data set. It divides the data set into three quartiles. This graph represents the minimum, maximum, median, first quartile and third quartile in the data set.

How do I change the size of a Boxplot in R?

The font size of the main title of boxplot can be changed by defining the font size value using par(cex. main=”size”), here size value can be changed based on our requirement. This needs to be done before creating the boxplot, otherwise, there will be no effect on the size of the main title.


3 Answers

Use the option frame=F (or frame.plot=F) in the boxplot function :

boxplot(count ~ spray, data = InsectSprays, col = "lightgray",frame=F)

Other parameters that can be used in the boxplot function are (rather inconveniently) listed on the helppage of ?bxp, which is the underlying function of boxplot()

like image 145
Joris Meys Avatar answered Oct 05 '22 00:10

Joris Meys


You can do this with bty in par. Using an example from the boxplot help:

par(bty='n')
boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
like image 42
Sacha Epskamp Avatar answered Oct 04 '22 23:10

Sacha Epskamp


boxplot() seems to accept the frame argument just fine.

 boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
 #vs    
 boxplot(count ~ spray, data = InsectSprays, col = "lightgray", frame = FALSE)
like image 45
Chase Avatar answered Oct 04 '22 22:10

Chase