Learn R Programming

ggalign (version 0.0.5)

stack_layout: Put plots horizontally or vertically

Description

[Experimental]

This function integrates the functionalities of stack_free() and stack_align() into a single interface. ggstack is an alias for stack_layout.

Usage

stack_layout(data = NULL, direction = NULL, type = NULL, ...)

Value

A StackLayout object.

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:

  • If type is align, fortify_data_frame() will be used to get a data frame.

  • If type is free, fortify_matrix() will be used to get a matrix.

direction

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

type

A string indicating the stack layout type: "align" for aligned plots (stack_align()) or "free" for free stacking (stack_free()).

...

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

See Also

  • stack_align()

  • stack_free()

Examples

Run this code
set.seed(123)
small_mat <- matrix(rnorm(56), nrow = 7L)
stack_layout(small_mat, "h", "align") + align_dendro()

# ggstack is an alias for `stack_layout`
ggstack(small_mat, "h", "align") + align_dendro()

# this is the same with:
stack_align(small_mat, "h") + align_dendro()

Run the code above in your browser using DataLab