% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/render-upset.R
\name{render_upset}
\alias{render_upset}
\title{Render an UpSet plot from a RegionResult}
\usage{
render_upset(
  result,
  max_columns = 20L,
  sort_by = c("size", "degree"),
  threshold = 0L,
  color_mode = c("depth", "heatmap", "custom"),
  colors = NULL
)
}
\arguments{
\item{result}{A [`RegionResult-class`].}

\item{max_columns}{Maximum number of intersections to display (default 20).
Top-N by the active sort.}

\item{sort_by}{`"size"` (default -- descending) or `"degree"` (membership
count ascending then alphabetical).}

\item{threshold}{Exclude intersections with size strictly below this value
(default 0L = no filter).}

\item{color_mode}{`"depth"` (default -- viridis on degree), `"heatmap"`
(Reds on size), or `"custom"` (use the `colors` mapping).}

\item{colors}{Named character vector mapping intersection LABELS (e.g.
`"AB"`) to fill hex colors when `color_mode = "custom"`. Unspecified
labels fall back to `"#cccccc"`.}
}
\value{
A `ggplot` object (saveable via `ggplot2::ggsave()`).
}
\description{
Builds a ComplexUpset ggplot showing intersection sizes (top bars), set
membership matrix (middle dot grid), and per-set sizes (left bars).
Idiomatic R port of Python `render_upset` -- same parameter contract, but
renders via ComplexUpset (ggplot2) instead of matplotlib (not a 1:1 port).
}
\examples{
ds <- methods::new("VennDataset",
    set_names = c("A", "B"),
    items = list(A = c("x", "y"), B = c("y", "z")),
    item_order = c("x", "y", "z"),
    universe_size = 10L, source_path = NULL, format = "csv")
result <- analyze(ds)
if (getRversion() >= "4.6") {
  p <- render_upset(result)
  inherits(p, "ggplot")
}
\donttest{
if (getRversion() >= "4.6") {
  result <- analyze(load_sample("dataset_real_cancer_drivers_4"))
  p <- render_upset(result, sort_by = "degree", color_mode = "heatmap")
  ggplot2::ggsave(tempfile(fileext = ".png"), p, width = 8, height = 5)
}
}
}
