Add borders to plot

theme_border(
  type = c("left", "right", "bottom", "top", "none"),
  colour = "black",
  size = 1,
  linetype = 1
)

Arguments

type

border(s) to display

colour

what colo(u)r should the border be

size

relative line thickness

linetype

"solid", "dashed", etc.

Value

adds borders to ggplot as a side effect

Details

Has ggplot2 display only specified borders, e.g. ('L'-shaped) borders, rather than a rectangle or no border. Note that the order can be significant; for example, if you specify the L border option and then a theme, the theme settings will override the border option, so you need to specify the theme (if any) before the border option, as above.

Author

Rudolf Cardinal

ggplot2 google group

Examples

if (FALSE) { # \dontrun{
df = data.frame( x=c(1,2,3), y=c(4,5,6) )
ggplot(data=df, aes(x=x, y=y)) + geom_point() + theme_bw() +
       opts(panel.border = theme_border(c('bottom','left')) )
ggplot(data=df, aes(x=x, y=y)) + geom_point() + theme_bw() +
       opts(panel.border = theme_border(c('b','l')) )
} # }