Learn R Programming

ggalign (version 0.0.5)

align: Create a New align Object

Description

[Experimental]

An align object interacts with the layout object to reorder or split observations and, in some cases, add plot components to the layout.

Usage

align(
  align_class,
  params,
  data,
  size = NULL,
  controls = NULL,
  limits = TRUE,
  facet = TRUE,
  no_axes = NULL,
  active = NULL,
  free_guides = deprecated(),
  free_spaces = deprecated(),
  plot_data = deprecated(),
  theme = deprecated(),
  free_labs = deprecated(),
  check.param = TRUE,
  call = caller_call()
)

Value

A new align object.

Arguments

align_class

A Align object.

params

A list of parameters for align_class.

data

Options for data:

  • A matrix, data frame, or atomic vector.

  • waiver(): Uses the layout matrix.

  • NULL: No data is set.

  • A function (including purrr-like lambda syntax) applied to the layout matrix.

size

The relative size of the plot, can be specified as a unit.

controls

Options for controls:

  • NULL: Used when align_*() functions do not add a plot.

  • waiver(): Try to infer controls based on data.

limits

Logical; if TRUE, sets layout limits for the plot.

facet

Logical; if TRUE, applies facets to the layout. If FALSE, limits will also be set to FALSE.

no_axes

[Experimental] Logical; if TRUE, removes axes elements for the alignment axis using theme_no_axes(). By default, will controled by the option- "ggalign.align_no_axes".

active

A active() object that defines the context settings when added to a layout.

free_guides

[Superseded] Please use plot_align() function instead.

free_spaces

[Deprecated] Please use plot_align() function instead.

plot_data

[Deprecated] Please use plot_data() function instead.

theme

[Deprecated] Please use plot_theme() function instead.

free_labs

[Deprecated] Please use plot_align() function instead.

check.param

Logical; if TRUE, checks parameters and provides warnings as necessary.

call

The call used to construct the Align object, for reporting messages.

Axis Alignment for Observations

It is important to note that we consider rows as observations, meaning vec_size(data)/NROW(data) must match the number of observations along the axis used for alignment (x-axis for a vertical stack layout, y-axis for a horizontal stack layout).

  • quad_layout()/ggheatmap(): For column annotation, the layout matrix will be transposed before use (if data is a function, it is applied to the transposed matrix), as column annotation uses columns as observations but alignment requires rows.

  • stack_layout(): The layout matrix is used as is, aligning all plots along a single axis.

Details

Each of the Align* objects is just a ggproto() object, descended from the top-level Align, and each implements various methods and fields.

To create a new type of Align* object, you typically will want to override one or more of the following:

  • setup_params: Prepare parameter or check parameters used by this plot.

  • setup_data: Prepare data used by this plot.

  • compute: A method used to compute statistics.

  • layout: A method used to group observations into panel or reorder observations.

  • draw: A method used to draw the plot. Must return a ggplot object.

Examples

Run this code
align_gg()
align_dendro()

Run the code above in your browser using DataLab