element_block: Specify Visual Properties for Table Blocks

Description Usage Arguments Details Value See Also Examples

View source: R/elements.bare.R

Description

Specify a set of graphical properties that can be used to highlight a rectangular block of table cells.

Usage

1
2
3
element_block(fill=NULL, fill_alpha=NULL, border_size=NULL, 
    border_colour=NULL, border_color=NULL, enabled=NULL, 
    inherit.blank=FALSE)

Arguments

fill, fill_alpha, border_size, border_color

Scalar graphical properties for the table blocks. These will be passed to ggplot2::geom_rect under the names fill, alpha, size, and colour, respectively.

border_colour

Alias for border_color.

enabled

Logical scalar, controlling whether the block is displayed (TRUE) or not (FALSE).

inherit.blank

Ignored.

Details

This function is modeled on the element_* functions used in ggplot2 to specify graphical properties in themes. It is primarily used to create the value on the right-hand side of an assignment involving the props<- group of setter functions.

To display a table block means to highlight its rectangular region with shading (as specified by fill, a color, and fill_alpha) and/or a border (with thickness specified by border_size, in mm, and color border_color). Blocks are drawn before entries and hvrules, so the latter are drawn "on top" of blocks and will not be hidden.

Quantitative property border_size may be specified using the ggplot2 function rel(). This function indicates that the value is to be interpreted as a multiplier to be applied to whatever the current value of the property is. For example border_size=rel(1.2) specifies that the thickness of the border around a block is to be increased by 20% from its current value.

Value

An object of S3 classes element_block and element.

See Also

element_entry, element_hvrule; elements for more detail about the available graphical properties; props<-, propsa<-, propsd<-.

Examples

1
2
3
4
5
6
plt <- plot(iris2_tab, title="Summary statistics for the iris data")
props(plt, id="rowhead") <- element_block(fill="lightblue")
props(plt, id="colblock/C/2/1") <- element_block(border_color="red")
      # (Default fill color for blocks is 'gray85')
plt
  

tablesgg documentation built on June 3, 2021, 1:06 a.m.