% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/EventSequenceGraph.R
\name{plot.event_sequence_graph}
\alias{plot.event_sequence_graph}
\title{Plot an event sequence graph.}
\usage{
\method{plot}{event_sequence_graph}(
  x,
  colorPalette = NULL,
  edgeWidthRange = c(0.5, 8),
  vertexSizeRange = c(8, 25),
  vertexLabelCex = 0.7,
  main = "Event Sequence Graph",
  ...
)
}
\arguments{
\item{x}{An \code{event_sequence_graph} object (returned by
\code{\link{buildEventSequenceGraph}}).}

\item{colorPalette}{Character vector of hex colors for nodes. If \code{NULL}
(default), a built-in palette is used. Colors are mapped by unique event
name (same event = same color across steps).}

\item{edgeWidthRange}{Numeric vector of length 2. Min and max edge widths
(default: \code{c(0.5, 8)}).}

\item{vertexSizeRange}{Numeric vector of length 2. Min and max vertex sizes
(default: \code{c(8, 25)}).}

\item{vertexLabelCex}{Label size multiplier (default: 0.7).}

\item{main}{Plot title (default: "Event Sequence Graph").}

\item{...}{Additional arguments passed to \code{\link[igraph]{plot.igraph}}.}
}
\value{
Invisibly returns the igraph object.
}
\description{
Produces a layered plot of the event sequence graph using \code{\link[igraph]{plot.igraph}}.
Nodes are laid out by step (left to right), with edge widths proportional to
patient counts and node sizes proportional to event counts within each step.
}
\examples{
if (requireNamespace("igraph", quietly = TRUE)) {
  cpResults <- list(
    pathwaysAnalysisPathsData = data.frame(
      pathwayAnalysisGenerationId = c(1L, 1L),
      targetCohortId = c(10L, 10L),
      step1 = c(2L, 4L),
      step2 = c(4L, NA_integer_),
      countValue = c(10L, 5L)
    ),
    pathwayAnalysisCodesLong = data.frame(
      pathwayAnalysisGenerationId = c(1L, 1L),
      code = c(2L, 4L),
      targetCohortId = c(10L, 10L),
      eventCohortId = c(1L, 2L),
      isCombo = c(0L, 0L),
      numberOfEvents = c(1L, 1L)
    ),
    isCombo = data.frame(
      targetCohortId = c(10L, 10L),
      comboId = c(2L, 4L),
      numberOfEvents = c(1L, 1L),
      isCombo = c(0L, 0L)
    )
  )

  generationSet <- data.frame(
    cohortId = c(1L, 2L, 10L),
    cohortName = c("Celecoxib", "Diclofenac", "NSAIDs")
  )

  esg <- buildEventSequenceGraph(cpResults, generationSet)
  plot(esg)
}

}
