Skip to contents

Sets up a multi-panel device layout for use with cograph plotting functions called with combined = FALSE. The previous par() settings are returned so that the caller can restore the device state.

Usage

panel_layout(spec, mar = c(2, 2, 3, 1), widths = NULL, heights = NULL)

Arguments

spec

Either a length-2 vector of positive integers c(nrow, ncol) for a uniform grid, or a numeric matrix of non-negative panel numbers with at least one positive cell, passed to graphics::layout().

mar

Numeric vector of length 4 giving panel margins. Default c(2, 2, 3, 1).

widths, heights

Optional numeric vectors of column widths and row heights, passed to graphics::layout(). They are valid only when spec is a matrix. Supplying them with a length-2 spec is an error.

Value

Invisibly, a list of the previous par() settings (mar and mfrow). Passing it to graphics::par() restores the prior device state and also clears a layout set by graphics::layout().

Details

A length-2 spec = c(nrow, ncol) creates a uniform grid through graphics::par(mfrow = ...). A matrix spec creates a non-uniform layout through graphics::layout(). The matrix values number the panel cells and are read in column-major order, so matrix(c(1, 1, 2, 3), 2, 2) gives one tall cell in the left column and two stacked cells in the right column.

Combined-flag scope

The combined = FALSE argument applies to the multi-panel plot functions plot_netobject_group(), plot_netobject_ml(), plot_net_bootstrap_group(), plot_group_permutation(), plot_difference(), splot.net_mlvar(type = "all"), plot_network_evolution(), plot.cograph_motifs(type = "network"), plot.cograph_motif_result(type = "patterns"), plot.cograph_motif_analysis(type = "patterns"), plot.tna_disparity(type = "comparison"), and splot() on group_tna and other list inputs. A single-network splot() call plots one panel and ignores combined.

Examples

op <- panel_layout(c(1, 2))
splot(regulation_net, combined = FALSE)
splot(regulation_net, layout = "circle", combined = FALSE)

graphics::par(op)