Skip to contents

[Stable]

The stack_discrete function arranges plots by aligning discrete variables. stack_align is an alias for stack_discrete for historical reasons.

Several aliases are provided for convenience:

  • stack_discretev and stack_alignv: A special case of stack_discrete that sets direction = "v".

  • stack_discreteh and stack_alignh: A special case of stack_discrete that sets direction = "h".

Usage

stack_discrete(direction, data = NULL, ..., theme = NULL, sizes = NA)

stack_align(direction, data = NULL, ..., theme = NULL, sizes = NA)

stack_discretev(data = NULL, ...)

stack_alignv(data = NULL, ...)

stack_discreteh(data = NULL, ...)

stack_alignh(data = NULL, ...)

Arguments

direction

A string indicating the direction of the stack layout, either "h"(horizontal) or "v"(vertical).

data

Default dataset to use for the layout. If not specified, it must be supplied in each plot added to the layout, fortify_matrix() will be used to convert data to a matrix.

...

Additional arguments passed to fortify_matrix().

theme

A theme() object used to customize various elements of the layout, including guides, title, subtitle, caption, margins, panel.border, and background. By default, the theme will inherit from the parent layout. It also controls the panel spacing for all plots in the layout.

sizes

A numeric value or a unit object. When used for the quad_layout() annotation, it must be of length 1. When used in the stack_layout() with a nested quad_layout(), it should be of length 3, specifying the relative heights (for direction = "h") or widths (for direction = "v") to be applied to the layout.

Examples

set.seed(123)
stack_discrete("h", matrix(rnorm(56), nrow = 7L)) +
    align_dendro()