Arrange plots horizontally or vertically by aligning discrete axis
Source:R/layout-stack-.R
stack_discrete.Rd
The stack_discrete
function arranges plots by aligning discrete variables.
stack_align
is an alias for stack_discrete
for historical reasons.
Several aliases are provided for convenience:
stack_discretev
andstack_alignv
: A special case ofstack_discrete
that setsdirection = "v"
.stack_discreteh
andstack_alignh
: A special case ofstack_discrete
that setsdirection = "h"
.
Usage
stack_discrete(direction, data = NULL, ..., theme = NULL, sizes = NA)
stack_align(direction, data = NULL, ..., theme = NULL, sizes = NA)
stack_discretev(data = NULL, ...)
stack_alignv(data = NULL, ...)
stack_discreteh(data = NULL, ...)
stack_alignh(data = NULL, ...)
Arguments
- direction
A string indicating the direction of the stack layout, either
"h"
(horizontal
) or"v"
(vertical
).- data
Default dataset to use for the layout. If not specified, it must be supplied in each plot added to the layout,
fortify_matrix()
will be used to convert data to a matrix.- ...
Additional arguments passed to
fortify_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.- sizes
A numeric value or a
unit
object. When used for thequad_layout()
annotation, it must be of length1
. When used in thestack_layout()
with a nestedquad_layout()
, it should be of length3
, specifying the relative heights (fordirection = "h"
) or widths (fordirection = "v"
) to be applied to the layout.
Examples
set.seed(123)
stack_discrete("h", matrix(rnorm(56), nrow = 7L)) +
align_dendro()