add-caugi_plot-caugi_plot: Compose Plots Horizontally

add-caugi_plot-caugi_plotR Documentation

Compose Plots Horizontally

Description

Arrange two plots side-by-side with configurable spacing. The + and | operators are equivalent and can be used interchangeably. Compositions can be nested to create complex multi-plot layouts.

Usage

## S3 method for class 'caugi_plot'
e1 + e2

## S3 method for class 'caugi_plot'
e1 | e2

Arguments

e1

A caugi_plot object (left plot)

e2

A caugi_plot object (right plot)

Details

The spacing between plots is controlled by the global option caugi_options()$plot$spacing, which defaults to grid::unit(1, "lines"). Compositions can be nested arbitrarily:

  • p1 + p2 - two plots side-by-side

  • (p1 + p2) + p3 - three plots in a row

  • (p1 + p2) / p3 - two plots on top, one below

Value

A caugi_plot object containing the composed layout

See Also

caugi_options() for configuring spacing and default styles

Other plotting: caugi_layout(), caugi_layout_bipartite(), caugi_layout_circle(), caugi_layout_fruchterman_reingold(), caugi_layout_kamada_kawai(), caugi_layout_sugiyama(), caugi_layout_tiered(), caugi_plot(), divide-caugi_plot-caugi_plot, plot.caugi()

Examples

cg1 <- caugi(A %-->% B, B %-->% C)
cg2 <- caugi(X %-->% Y, Y %-->% Z)

p1 <- plot(cg1, main = "Graph 1")
p2 <- plot(cg2, main = "Graph 2")

# Horizontal composition
p1 + p2
p1 | p2 # equivalent

# Adjust spacing
caugi_options(plot = list(spacing = grid::unit(2, "lines")))
p1 + p2


caugi documentation built on Oct. 28, 2026, 1:07 a.m.