Sam Weisenthal
Sam Weisenthal

Reputation: 2951

How to show all 4 borders in R `hist()`?

R hist() shows only the bottom and left border by default. In plot(), we can use frame.border=TRUE to show all 4 borders. In hist, not so. Is there a way to show all 4 borders in hist()?

Upvotes: 1

Views: 219

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368579

Just call box() to enclose the plot figure you just created in a "box" on all four sides as you desire.

Code

> hist(mtcars$disp)
> box()

Output

enter image description here

Details

Per help(box):

Draw a Box around a Plot

Description:

     This function draws a box around the current plot in the given
     color and linetype.  The ‘bty’ parameter determines the type of
     box drawn.  See ‘par’ for details.

Upvotes: 4

Related Questions