Skip to contents

Determine the active context of stack layout

Usage

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

Arguments

sizes

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

guides

A boolean value or a string containing one or more of "t", "l", "b", and "r" indicates which guide should be collected. If NULL, no guides will be collected. Default: "tlbr".

free_labs

A boolean value or a string containing one or more of "t", "l", "b", and "r" indicates which axis title should be free from alignment. If NULL, all axis title will be aligned. Default: "tlbr".

free_spaces

A boolean value or a string containing one or more of "t", "l", "b", and "r" indicates which border spaces should be removed. If NULL (default), no space will be removed.

plot_data

A function used to transform the plot data before rendering. By default, it'll inherit from the parent layout. If no parent layout, the default is NULL, which means we won't want to modify anything.

Used to modify the data after layout has been created, 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

A theme() object to rendering the guides, title, subtitle, caption, margins and background. Only used when position is NULL.

what

What should get activated for the stack layout? Possible values are follows:

  • A single number or string of the plot elements in the stack layout. Usually you are waive to use this, since the adding procedure can be easily changed.

  • NULL: Remove any active context, this is useful when the active context is a layout_heatmap() object, where any Align objects will be added into the heatmap. By removing the active context, we can add Align object into the layout_stack() .

Value

A stack_active object which can be added into StackLayout.

Examples

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()