% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plotly_exposure.R
\name{plotly_exposure}
\alias{plotly_exposure}
\title{Interactive Exposure Plot.}
\usage{
plotly_exposure(
  exposure_obj,
  showGrid = TRUE,
  main = "Exposure Plot",
  xlab = "Time",
  ylab = "Event Rate",
  fitCol = "black",
  gridCol = "lightgray",
  signif = 3,
  cols = NULL
)
}
\arguments{
\item{exposure_obj}{An object of class 'exposure', or a list of such objects.
Each object is created using the `exposure()` function from the `ReliaGrowR`
package.}

\item{showGrid}{Show grid (TRUE) or hide grid (FALSE). Default is TRUE.}

\item{main}{Main title. Default is "Exposure Plot".}

\item{xlab}{X-axis label. Default is "Time".}

\item{ylab}{Y-axis label. Default is "Event Rate".}

\item{fitCol}{Color of the event rate step function. Default is "black". Used
only for a single exposure object; ignored when `cols` is provided or multiple
objects are supplied.}

\item{gridCol}{Color of the grid. Default is "lightgray".}

\item{signif}{Significant digits of results. Default is 3. Must be a positive integer.}

\item{cols}{Optional character vector of colors, one per exposure object. When
provided, each object's step function is drawn in the corresponding color.
Recycled if shorter than the number of objects.}
}
\value{
A `plotly` object representing the interactive exposure plot.
}
\description{
The function creates an interactive exposure plot for one or more \code{exposure}
objects. When a list of objects is provided the estimates are overlaid on the
same plot, each rendered in a distinct color. The plot shows the instantaneous
event rate (events per unit time per system at risk) as a step function,
calculated from recurrence data by dividing the event count in each interval
by the total system-time at risk during that interval.
}
\details{
Unlike [plotly_mcf()] which shows cumulative events, the exposure plot
shows the instantaneous event rate: the number of events per unit time
per system at risk in each interval. A flat exposure plot suggests a
constant event rate (homogeneous Poisson process); a declining rate
suggests improvement; a rising rate suggests degradation. Use this plot
alongside [plotly_mcf()] to diagnose time-dependence in the event process.
}
\examples{
library(ReliaGrowR)
ids <- c("A", "A", "A", "B", "B", "C", "C", "C", "C")
times <- c(50, 150, 350, 100, 300, 80, 200, 320, 450)
fit <- exposure(id = ids, time = times)
plotly_exposure(fit)

# Overlay two exposure objects
fit2 <- exposure(id = c("X", "X", "Y"), time = c(60, 220, 180))
plotly_exposure(list(fit, fit2), cols = c("steelblue", "tomato"))
}
\seealso{
[plotly_mcf()] for the cumulative view; [plotly_nhpp()] for a
parametric NHPP model.
}
