% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nl_plot.R
\name{nl_plot}
\alias{nl_plot}
\title{Plot predictions and derivatives from nl_fit models}
\usage{
nl_plot(
  pred_df = NULL,
  deriv_df = NULL,
  x,
  time = NULL,
  type = c("trajectory", "slope", "curvature", "combo"),
  show_ci = TRUE,
  ci_level = 0.95,
  show_turning_points = FALSE,
  turning_points = NULL,
  zero_line = TRUE,
  y_lab = NULL,
  x_lab = NULL,
  title = NULL,
  legend_title = NULL
)
}
\arguments{
\item{pred_df}{A data frame from \code{\link{nl_predict}} (for
\code{type = "trajectory"} or \code{"combo"}).}

\item{deriv_df}{A data frame from \code{\link{nl_derivatives}} (for
\code{type = "slope"}, \code{"curvature"}, or \code{"combo"}).}

\item{x}{Character; name of the focal predictor column in \code{pred_df} /
\code{deriv_df}.}

\item{time}{Optional character; name of the time column. Auto-detected if
\code{NULL}.}

\item{type}{Plot type: \code{"trajectory"} (default), \code{"slope"},
\code{"curvature"}, or \code{"combo"}.}

\item{show_ci}{Logical; add confidence ribbons. Default \code{TRUE}.}

\item{ci_level}{Numeric; confidence level when deriving CI from
\code{se.fit}. Default \code{0.95}.}

\item{show_turning_points}{Logical; overlay turning-point markers on the
trajectory plot. Default \code{FALSE}.}

\item{turning_points}{Data frame from \code{\link{nl_turning_points}} (only
used when \code{show_turning_points = TRUE}).}

\item{zero_line}{Logical; for slope / curvature plots, draw a dashed
horizontal line at zero. Default \code{TRUE}.}

\item{y_lab}{Y-axis label.}

\item{x_lab}{X-axis label. Defaults to \code{x}.}

\item{title}{Optional plot title.}

\item{legend_title}{Optional legend title.}
}
\value{
A \code{ggplot} object (or a combined plot list for \code{"combo"}).
}
\description{
Visualises results from \code{\link{nl_predict}} or
\code{\link{nl_derivatives}}.  The \code{type} argument selects the plot:
\itemize{
\item \code{"trajectory"}: predicted outcome vs \code{x} with optional
confidence ribbon (v1 behaviour, now default).
\item \code{"slope"}: first derivative (marginal effect) vs \code{x}.
\item \code{"curvature"}: second derivative vs \code{x}.
\item \code{"combo"}: trajectory + slope panels side by side.
}
}
\seealso{
\code{\link{nl_predict}}, \code{\link{nl_derivatives}},
\code{\link{nl_turning_points}}
}
