% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/compose.R
\name{eulergram-compose}
\alias{eulergram-compose}
\alias{|.eulergram}
\alias{/.eulergram}
\title{Compose Euler Diagrams}
\usage{
\method{|}{eulergram}(e1, e2)

\method{/}{eulergram}(e1, e2)
}
\arguments{
\item{e1, e2}{\code{eulergram} objects, typically returned by \code{\link[=plot.euler]{plot.euler()}}.}
}
\value{
An \code{eulergram} containing the composed layout.
}
\description{
Arrange two \code{eulergram} objects side-by-side or stacked, building up
multi-panel layouts with operator syntax. Compositions can be nested
arbitrarily, e.g. \code{(p1 | p2) / p3}.
}
\details{
\code{|} arranges the two plots horizontally; \code{/} stacks them vertically.
The result is itself an \code{eulergram}, so further composition chains
naturally.

The gap between adjacent plots is controlled by the
\code{composition$spacing} entry of \code{\link[=eulerr_options]{eulerr_options()}}, which must be a
\code{\link[grid:unit]{grid::unit()}} and defaults to \code{grid::unit(1, "lines")}.

Because composition is binary and recursive, panels at different
nesting levels are not size-aligned. In \code{(p1 | p2) / p3}, \code{p3} spans
the full bottom row while \code{p1} and \code{p2} split the top row equally.
}
\examples{
p1 <- plot(euler(c(A = 1, B = 8, "A&B" = 1)))
p2 <- plot(euler(c(A = 1, C = 1, "A&C" = 1)))

p1 | p2
p1 / p2

p3 <- plot(euler(c(X = 3, Y = 2, "X&Y" = 1)))
(p1 | p2) / p3

}
\seealso{
\code{\link[=plot.euler]{plot.euler()}}, \code{\link[=eulerr_options]{eulerr_options()}}
}
