Learn R Programming

ggalign (version 0.0.4)

stack_active: Determine the active context of stack layout

Description

Determine the active context of stack layout

Usage

stack_active(
  guides = NA,
  free_spaces = NA,
  plot_data = NA,
  theme = NA,
  free_labs = NA,
  what = NULL,
  sizes = NULL
)

Value

A stack_active object which can be added into StackLayout.

Arguments

guides

A string containing one or more of "t", "l", "b", and "r" indicates which side of guide legends should be collected. If NULL, no guide legends will be collected. If waiver(), it will inherit from the parent layout

free_spaces

A string with one or more of "t", "l", "b", and "r" indicating which border spaces should be removed. Defaults to waiver(), which inherits from the parent layout. If no parent, the default is NULL, meaning no spaces are removed.

plot_data

A function to transform plot data before rendering. Defaults to waiver(), which inherits from the parent layout. If no parent layout, the default is NULL, meaning the data won't be modified.

Used to modify the data after layout has been created, which should be a data frame, but before the data is handled of to the ggplot2 for rendering. Use this hook if the you needs change the default data for all geoms.

theme

Default theme for the plot in the layout. One of:

  • waiver(): will inherit from the parent layout.

  • NULL: Use the default theme.

  • theme(): will be added with the parent layout theme.

free_labs

A string with one or more of "t", "l", "b", and "r" indicating which axis titles should be free from alignment. Defaults to waiver(), which inherits from the parent layout. If no parent layout, no axis titles will be aligned. If NULL, all axis titles will be aligned.

what

What should get activated for the stack layout? Options include::

  • A single number or string of the plot elements in the stack layout.

  • NULL: remove any active context, this is useful when the active context is a heatmap_layout() object, where any align_*() will be added into the heatmap. By removing the active context, we can add align_*() into the stack_layout().

sizes

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

Examples

Run this code
ggstack(matrix(1:9, nrow = 3L)) +
    ggheatmap() +
    # ggheamtap will set the active context, directing following addition
    # into the heatmap plot area. To remove the heatmap active context,
    # we can use `stack_active()` which will direct subsequent addition into
    # the stack
    stack_active() +
    # here we add a dendrogram to the stack.
    align_dendro()

Run the code above in your browser using DataLab