This function arranges plots around the quad-sides of a main plot, aligning both horizontal and vertical axes, and can handle either discrete or continuous variables.
If
xlimis provided, a continuous variable will be required and aligned in the vertical direction. Otherwise, a discrete variable will be required and aligned.If
ylimis provided, a continuous variable will be required and aligned in the horizontal direction. Otherwise, a discrete variable will be required and aligned.
The quad_discrete is a special case where both xlim and ylim are not
provided.
The quad_continuous is a special case where both xlim and ylim are
provided.
For historical reasons, the following aliases are available:
quad_alignh: Align discrete variables in the horizontal direction and continuous variables in vertical direction.quad_alignv: Align discrete variables in the vertical direction and continuous variables in horizontal direction.quad_alignbis an alias forquad_discrete.quad_freeis an alias forquad_continuous.
Usage
quad_layout(
data = waiver(),
mapping = aes(),
xlim = waiver(),
ylim = waiver(),
...,
theme = NULL,
active = NULL,
width = NA,
height = NA
)
quad_alignh(..., ylim = waiver())
quad_alignv(..., xlim = waiver())
quad_discrete(
data = waiver(),
mapping = aes(),
...,
theme = NULL,
active = NULL,
width = NA,
height = NA
)
quad_continuous(
data = waiver(),
mapping = aes(),
xlim = NULL,
ylim = NULL,
...,
theme = NULL,
active = NULL,
width = NA,
height = NA
)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, this will attempt to inherit from the parent layout.
If both
xlimandylimare provided, adata frameis required, andfortify_data_frame()will be used to convert the data to a data frame. When inherited by an annotation stack, no transposition will be applied.Otherwise, a
matrixis required, andfortify_matrix()will be used to convert the data to a matrix. When inherited by the column annotation stack, the data will be transposed.- mapping
Default list of aesthetic mappings to use for main plot in the layout. If not specified, must be supplied in each layer added to the main plot.
- xlim, ylim
A
continuous_limits()object specifying the left/lower limit and the right/upper limit of the scale. Used to align the continuous axis.- ...
Additional arguments passed to
fortify_data_frame()orfortify_matrix().- theme
A
theme()object used to customize various elements of the layout, includingguides,title,subtitle,caption,margins,panel.border, andbackground. By default, the theme will inherit from the parentlayout. It also controls the panel spacing for all plots in the layout.- active
A
active()object that defines the context settings when added to a layout.- width, height
The relative width/height of the main plot, can be a
unitobject.
ggplot2 specification
If either xlim or ylim is not provided, the data input will be converted
to a matrix using fortify_matrix(), and the data in the underlying main
plot will contain the following columns:
.panel_xand.panel_y: the column and row panel groups..xand.y: an integer index ofxandycoordinates.discrete_xand.discrete_y: a factor of the data labels (only applicable when.row_namesand.column_namesexists)..row_namesand.column_names: A character of the row and column names of the original matrix (only applicable when names exist)..row_indexand.column_index: the row and column index of the original matrix.value: the actual matrix value.
Otherwise, the data input will be used for the main plot.
