autoplot.gg: 'autoplot' methods for 'ggRandomForests' data objects

autoplot.ggR Documentation

autoplot methods for ggRandomForests data objects

Description

These methods let you use ggplot2::autoplot() on any gg_* object returned by ggRandomForests. They are thin wrappers around the corresponding plot.gg_*() S3 methods, so all arguments accepted by those methods are forwarded via ....

Usage

## S3 method for class 'gg_error'
autoplot(object, ...)

## S3 method for class 'gg_vimp'
autoplot(object, ...)

## S3 method for class 'gg_rfsrc'
autoplot(object, ...)

## S3 method for class 'gg_variable'
autoplot(object, ...)

## S3 method for class 'gg_partial'
autoplot(object, ...)

## S3 method for class 'gg_partial_rfsrc'
autoplot(object, ...)

## S3 method for class 'gg_partialpro'
autoplot(object, ...)

## S3 method for class 'gg_roc'
autoplot(object, ...)

## S3 method for class 'gg_survival'
autoplot(object, ...)

## S3 method for class 'gg_brier'
autoplot(object, ...)

Arguments

object

A gg_* data object (see Details).

...

Additional arguments forwarded to the underlying plot.gg_*() method.

Details

The following gg_* classes are supported:

gg_error

OOB error vs. number of trees

gg_vimp

Variable importance ranking

gg_rfsrc

Predicted vs. observed values

gg_variable

Marginal dependence

gg_partial

Partial dependence (via plot.variable)

gg_partial_rfsrc

Partial dependence (via partial.rfsrc)

gg_partialpro

Partial dependence (via varPro)

gg_roc

ROC curve

gg_survival

Survival / cumulative hazard curves

gg_brier

Time-resolved Brier score and CRPS

Value

A ggplot object.

Examples


library(ggplot2)
set.seed(42)
rf <- randomForestSRC::rfsrc(Ozone ~ ., data = na.omit(airquality),
                              ntree = 50, importance = TRUE,
                              tree.err = TRUE)
autoplot(gg_error(rf))
autoplot(gg_vimp(rf))


ggRandomForests documentation built on May 12, 2026, 5:07 p.m.