Learn R Programming

ggalign (version 0.0.5)

stack_align: Arrange Plots Horizontally or Vertically

Description

[Experimental]

The stack_align function aligns observations, while stack_free does not.

Several aliases are provided for convenience:

  • stack_alignv: A special case of stack_align that sets direction = "vertical".

  • stack_alignh: A special case of stack_align that sets direction = "horizontal".

  • stack_freev: A special case of stack_free that sets direction = "vertical".

  • stack_freeh: A special case of stack_free that sets direction = "horizontal".

Usage

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

stack_alignv(data = NULL, ...)

stack_alignh(data = NULL, ...)

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

stack_freev(data = NULL, ...)

stack_freeh(data = NULL, ...)

Arguments

data

Default dataset to use for the layout. If not specified, it must be supplied in each plot added to the layout. By default, it will try to inherit from parent layout:

  • For stack_free, fortify_data_frame() will be used to convert data to a data frame.

  • For stack_align, fortify_matrix() will be used to convert data to a matrix.

direction

A string indicating the direction of the stack layout, either "horizontal" or "vertical".

...

Additional arguments passed to fortify_data_frame() or fortify_matrix().

theme

A theme() used to render the guides, title, subtitle, caption, margins, patch.title, panel.border, and background. If NULL (default), will inherit from the parent layout.

sizes

A numeric or a unit object of length 3 indicating the relative heights (for direction = "horizontal") or widths (for direction = "vertical").

Examples

Run this code
set.seed(123)
stack_align(matrix(rnorm(56), nrow = 7L), "h") +
    align_dendro()

Run the code above in your browser using DataLab