View source: R/plot.gg_partial.R
| plot.gg_partial | R Documentation |
gg_partial objectProduces 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.
## S3 method for class 'gg_partial'
plot(x, ...)
x |
A |
... |
Not currently used; reserved for future arguments. |
A ggplot (or patchwork) object. When only one
variable type is present a single ggplot is returned. When both
continuous and categorical variables are present the two panels are
combined vertically via patchwork::wrap_plots(), which also
satisfies inherits(p, "ggplot").
gg_partial, plot.gg_variable
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.