% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.gg_partial.R
\name{plot.gg_partial}
\alias{plot.gg_partial}
\title{Plot a \code{\link{gg_partial}} object}
\usage{
\method{plot}{gg_partial}(x, ...)
}
\arguments{
\item{x}{A \code{\link{gg_partial}} object (output of \code{\link{gg_partial}}).}

\item{...}{Not currently used; reserved for future arguments.}
}
\value{
A \code{ggplot} (or \code{patchwork}) object.  When only one
variable type is present a single \code{ggplot} is returned.  When both
continuous and categorical variables are present the two panels are
combined vertically via \code{patchwork::wrap_plots()}, which also
satisfies \code{inherits(p, "ggplot")}.
}
\description{
Turns a \code{\link{gg_partial}} object into a ggplot2 figure.  Each curve
is a partial dependence trace -- the forest's average prediction as one
predictor is swept across its range while the rest are marginalized over the
training data.  Continuous predictors appear as line plots; categorical
predictors appear as bar charts.  Both panels are faceted by variable name
so you can compare the shape and scale of each variable's effect at a
glance.
}
\details{
When a \code{model} label was attached in \code{gg_partial()}, lines are
coloured by model -- handy for overlaying results from two forests (e.g.,
one tuned, one default) in the same figure.
}
\examples{
set.seed(42)
airq <- na.omit(airquality)
rf <- randomForestSRC::rfsrc(Ozone ~ ., data = airq, ntree = 50)
pv <- randomForestSRC::plot.variable(rf, partial = TRUE, show.plots = FALSE)
pd <- gg_partial(pv)
plot(pd)

}
\seealso{
\code{\link{gg_partial}}, \code{\link{plot.gg_variable}}
}
