graphics (version 3.3.0)

box: Draw a Box around a Plot


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.


box(which = "plot", lty = "solid", ...)


character, one of "plot", "figure", "inner" and "outer".
line type of the box.
further graphical parameters, such as bty, col, or lwd, see par. Note that xpd is not accepted as clipping is always to the device region.


The choice of colour is complicated. If col was supplied and is not NA, it is used. Otherwise, if fg was supplied and is not NA, it is used. The final default is par("col").


Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

See Also

rect for drawing of arbitrary rectangles.


Run this code
plot(1:7, abs(stats::rnorm(7)), type = "h", axes = FALSE)
axis(1, at = 1:7, labels = letters[1:7])
box(lty = '1373', col = 'red')

Run the code above in your browser using DataLab