element_hvrule {tablesgg}R Documentation

Specify Visual Properties for Table Rules

Description

Specify a set of graphical properties that can be used to display horizontal or vertical rules (hvrules) in a table.

Usage

element_hvrule(colour=NULL, alpha=NULL, linetype=NULL, size=NULL, 
    fill=NULL, fill_alpha=NULL, space=NULL, color=NULL, enabled=NULL, 
    inherit.blank=FALSE)

Arguments

color, alpha, linetype, size

Scalar values for the graphical properties that are used to display the horizontal or vertical line of an hvrule. Values will be passed to ggplot2::geom_segment (size as linewidth).

fill, fill_alpha, space

Scalar values for the graphical properties of the (long, thin) rectangle that encloses an hvrule. space is the height (for a horizontal rule) or width (for a vertical rule) of the rectangle, in millimeters. fill and fill_alpha are passed to ggplot2::geom_rect as arguments fill and alpha respectively.

colour

Alias for color.

enabled

Logical scalar, controlling whether the hvrule is displayed (TRUE) or not (FALSE). This applies to both the actual rule (line) and the rectangle containing it.

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.

A horizontal or vertical rule (hvrule) is actually drawn as long, narrow rectangle, with a line centered inside it. The narrowness of the rectangle, and thus how much space the hvrule adds to the table, is controlled by space. The thickness of the line inside the rectangle is controlled by size. Setting linetype to 0 means no line will be drawn, but the enclosing rectangle will be. In that way hvrules can be used to insert extra blank space between rows or columns of a table.

Quantitative properties size and space 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 space=rel(1.2) specifies that the space property of an entry is to be increased by 20% from its current value.

Value

An object of S3 classes element_hvrule and element.

See Also

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

Examples

plt <- plot(iris2_tab, title="Summary statistics for the iris data")
plt

# Enable the vertical rule between rowhead and body, and set its
# properties:
props(plt, id="rowhead_right") <- element_hvrule(enabled=TRUE, linetype=1, 
                                                 color="black", space=10)
plt
# Change the properties of all enabled hvrules:
propsd(plt, subset=(enabled)) <- element_hvrule(color="red")
plt
  

[Package tablesgg version 0.9-1 Index]