Learn R Programming

caugi (version 1.0.0)

add-caugi_plot-caugi_plot: 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.

Value

A caugi_plot object containing the composed layout

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

See Also

caugi_options() for configuring spacing and default styles

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

Examples

Run this code
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

Run the code above in your browser using DataLab