autoplot.TaskSurv: Plot for Survival Tasks

View source: R/autoplot.R

autoplot.TaskSurvR Documentation

Plot for Survival Tasks

Description

Generates plots for TaskSurv, depending on argument type:

  • "target": Calls GGally::ggsurv() on a survival::survfit() object. This computes the Kaplan-Meier survival curve for the observations if this task.

  • "duo": Passes data and additional arguments down to GGally::ggduo(). columnsX is target, columnsY is features.

  • "pairs": Passes data and additional arguments down to GGally::ggpairs(). Color is set to target column.

Usage

## S3 method for class 'TaskSurv'
autoplot(
  object,
  type = "target",
  theme = theme_minimal(),
  reverse = FALSE,
  ...
)

Arguments

object

(TaskSurv).

type

(character(1)):
Type of the plot. See above for available choices.

theme

(ggplot2::theme())
The ggplot2::theme_minimal() is applied by default to all plots.

reverse

(logical())
If TRUE and type = 'target', it plots the Kaplan-Meier curve of the censoring distribution. Default is FALSE.

...

(any): Additional arguments. rhs is passed down to ⁠$formula⁠ of TaskSurv for stratification for type "target". Other arguments are passed to the respective underlying plot functions.

Value

ggplot2::ggplot() object.

Examples


library(mlr3)
library(mlr3viz)
library(mlr3proba)
library(ggplot2)

task = tsk("lung")
task$head()

autoplot(task) # KM
autoplot(task) # KM of the censoring distribution
autoplot(task, rhs = "sex")
autoplot(task, type = "duo")


mlr-org/mlr3proba documentation built on April 12, 2025, 4:38 p.m.