% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.gg_partial.R
\name{plot.gg_partialpro}
\alias{plot.gg_partialpro}
\title{Plot a \code{\link{gg_partialpro}} object}
\usage{
\method{plot}{gg_partialpro}(x, type = c("parametric", "nonparametric", "causal"), ...)
}
\arguments{
\item{x}{A \code{\link{gg_partialpro}} object.}

\item{type}{Character vector; one or more of \code{"parametric"},
\code{"nonparametric"}, \code{"causal"}.  Defaults to all three.}

\item{...}{Not currently used.}
}
\value{
A \code{ggplot} (or \code{patchwork}) object.  When both continuous
  and categorical variables are present the two panels are combined
  vertically via \code{patchwork::wrap_plots()}.
}
\description{
Produces ggplot2 partial dependence curves from the named list returned by
\code{\link{gg_partialpro}}, which wraps \code{varpro::partialpro} output.
}
\details{
Each variable produces up to three effect curves: parametric, nonparametric,
and causal.  The \code{type} argument controls which are shown.
}
\examples{
## ggRandomForests does not depend on the varpro package; we construct a
## minimal mock of the partialpro() output so the example runs everywhere.
set.seed(42)
n_obs <- 30
n_pts <- 15
mock_data <- list(
  age = list(
    xvirtual    = seq(30, 80, length.out = n_pts),
    xorg        = sample(seq(30, 80, by = 5), n_obs, replace = TRUE),
    yhat.par    = matrix(rnorm(n_obs * n_pts), nrow = n_obs),
    yhat.nonpar = matrix(rnorm(n_obs * n_pts), nrow = n_obs),
    yhat.causal = matrix(rnorm(n_obs * n_pts), nrow = n_obs)
  ),
  sex = list(
    xvirtual    = c(0, 1),
    xorg        = sample(c(0, 1), n_obs, replace = TRUE),
    yhat.par    = matrix(rnorm(n_obs * 2), nrow = n_obs),
    yhat.nonpar = matrix(rnorm(n_obs * 2), nrow = n_obs),
    yhat.causal = matrix(rnorm(n_obs * 2), nrow = n_obs)
  )
)

pp <- gg_partialpro(mock_data)

# Returns a single ggplot/patchwork figure combining continuous and
# categorical panels when both variable types are present.
plot(pp)

# Restrict to one or two effect types
plot(pp, type = "nonparametric")
plot(pp, type = c("parametric", "causal"))

}
\seealso{
\code{\link{gg_partialpro}}
}
