element_roundrect: round rectangle borders and backgrounds

View source: R/ggelement.R

element_roundrectR Documentation

round rectangle borders and backgrounds

Description

round rectangle borders and backgrounds

Usage

element_roundrect(
  fill = NULL,
  colour = NULL,
  size = NULL,
  linetype = NULL,
  color = NULL,
  r = grid::unit(0.1, "snpc"),
  inherit.blank = FALSE
)

Arguments

fill

Fill colour.

colour, color

Line/border colour. Color is an alias for colour.

size

text size in pts.

linetype

Line type. An integer (0:8), a name (blank, solid, dashed, dotted, dotdash, longdash, twodash), or a string with an even number (up to eight) of hexadecimal digits which give the lengths in consecutive positions in the string.

r

the radius of the rounded corners, a unit object, default is unit(0.1, 'snpc').

inherit.blank

Should this element inherit the existence of an element_blank among its parents? If TRUE the existence of a blank element among its parents will cause this element to be blank as well. If FALSE any blank parent element will be ignored when calculating final element state.

Examples

library(ggplot2)
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p <- p + facet_grid(cols = vars(cyl))
p <- p + theme(strip.background=element_roundrect(fill="grey40", color=NA, r=0.15))
p
p2 <- ggplot(mtcars, aes(mpg, disp, color=factor(cyl), size=cyl)) + 
      geom_point()
p2 + theme(legend.background=element_roundrect(color="#808080", linetype=2))

ggfun documentation built on Oct. 30, 2024, 9:13 a.m.