plot.gg_partial: Plot a 'gg_partial' object

View source: R/plot.gg_partial.R

plot.gg_partialR Documentation

Plot a gg_partial object

Description

Produces ggplot2 partial dependence curves from the named list returned by gg_partial. Continuous predictors are shown as line plots; categorical predictors are shown as bar charts. Both panels are faceted by variable name so multiple predictors can be compared at a glance.

Usage

## S3 method for class 'gg_partial'
plot(x, ...)

Arguments

x

A gg_partial object (output of gg_partial).

...

Not currently used; reserved for future arguments.

Value

When only continuous or only categorical variables are present, a single ggplot object. When both are present, a named list with elements continuous and categorical, each a ggplot.

See Also

gg_partial, plot.gg_variable

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)


ggRandomForests documentation built on May 2, 2026, 5:06 p.m.