Learn R Programming

ggalign (version 0.0.4)

align_panel: Create ggplot object with layout panel data

Description

This is similar with ggalign() function, but it will always use the layout panel data. ggpanel is just an alias of align_panel.

Usage

align_panel(
  mapping = aes(),
  size = NULL,
  free_guides = waiver(),
  free_spaces = waiver(),
  plot_data = waiver(),
  theme = waiver(),
  free_labs = waiver(),
  limits = TRUE,
  facet = TRUE,
  set_context = TRUE,
  order = NULL,
  name = NULL
)

ggpanel( mapping = aes(), size = NULL, free_guides = waiver(), free_spaces = waiver(), plot_data = waiver(), theme = waiver(), free_labs = waiver(), limits = TRUE, facet = TRUE, set_context = TRUE, order = NULL, name = NULL )

Value

A AlignPanel object.

Arguments

mapping

Additional default list of aesthetic mappings to use for plot.

size

Plot size, can be an unit object.

free_guides

Override the guides argument specified in the layout for a plot. Options include:

  • waiver(): inherits behavior from the layout.

  • NULL: no guide legends will be collected for the plot.

  • A string containing one or more of "t", "l", "b", and "r" indicates which side of guide legends should be collected for the plot..

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 plot theme: One of:

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

  • NULL: Use the default theme.

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

Note: The axis title and labels parallel to the layout axis will always be removed by default. For vertical stack layouts, this refers to the x-axis, and for horizontal stack layouts, this refers to the y-axis. If you want to display the axis title or labels, you should manually add theme() elements for the parallel axis title or labels.

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.

limits

A boolean value indicates whether to set the layout limtis for the plot.

facet

A boolean value indicates whether to set the layout facet for the plot. If this is FALSE, limits will always be FALSE too.

set_context

A single boolean value indicates whether to set the active context to current plot. If TRUE, all subsequent ggplot elements will be added into this plot.

order

An single integer for the plot area order.

name

A string of the plot name. Used to switch the active context in hmanno() or stack_active().

ggplot2 specification

align_panel initializes a ggplot data and mapping.

align_panel() always applies a default mapping for the axis of the data index in the layout. This mapping is aes(y = .data$.y) for horizontal stack layout (including left and right heatmap annotation) and aes(x = .data$.x) for vertical stack layout (including top and bottom heatmap annotation).

The data in the underlying ggplot object contains following columns:

  • .panel: the panel for current layout axis. It means x-axis for vertical stack layout, y-axis for horizontal stack layout.

  • .index: the index of the original layout data.

  • .x or .y: the x or y coordinates

Examples

Run this code
ggheatmap(matrix(rnorm(81), nrow = 9)) +
    hmanno("top") +
    ggalign() +
    geom_point(aes(y = value))

Run the code above in your browser using DataLab