element_rect_round: Rounded rectangle theme element

View source: R/element_rect_round.R

element_rect_roundR Documentation

Rounded rectangle theme element

Description

Draws rectangles with rounded corners in conjuction with the theme system.

Usage

element_rect_round(
  fill = NULL,
  colour = NULL,
  linewidth = NULL,
  linetype = NULL,
  color = NULL,
  inherit.blank = FALSE,
  radius = unit(0.1, "snpc")
)

Arguments

fill

Fill colour.

colour, color

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

linewidth

Line/border size in mm.

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.

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.

radius

A unit of length 1 specifying the maximum radius of circles inscribing the corners. If given a numeric, it is converted to a unit object with the "snpc" unit.

x

A single number specifying size relative to parent element.

lineend

Line end Line end style (round, butt, square)

Value

A list of the class element_rect_round.

Examples

# Adding rounded rectangles to geoms and theme elements
ggplot(mpg, aes(class, colour = class)) +
  geom_bar_theme(element = element_rect_round(radius = 0.25)) +
  facet_grid(~ year) +
  theme(
    strip.background = element_rect_round(radius = 0.5),
    panel.background = element_rect_round()
  )

teunbrand/elementalist documentation built on Oct. 13, 2024, 11:11 a.m.