Learn R Programming

survminer (version 0.3.1)

ggcumcensor: Cumulative Number of Censored Subjects

Description

Plot the cumulative number of censored subjects, the number of subjects who exit the risk set, without an event, at time t. Normally, users don't need to use this function directly. Internally used by the function ggsurvplot.

Usage

ggcumcensor(fit, data = NULL, color = "black", palette = NULL,
  break.time.by = NULL, xlim = NULL, title = "Number of cenored subjects",
  xlab = "Time", ylab = "Strata", legend = "top",
  legend.title = "Strata", legend.labs = NULL, y.text = TRUE,
  y.text.col = TRUE, fontsize = 4.5, ggtheme = theme_survminer(), ...)

Arguments

fit

an object of class survfit.

data

a dataset used to fit survival curves. If not supplied then data will be extracted from 'fit' object.

color

color to be used for the survival curves. This argument is ignored when the number of strata (groups > 1). In this case, use the argument palette.

palette

the color palette to be used. Allowed values include "hue" for the default hue color scale; "grey" for grey color palettes; brewer palettes e.g. "RdBu", "Blues", ...; or custom color palette e.g. c("blue", "red"). See details section for more information.

break.time.by

numeric value controlling time axis breaks. Default value is NULL.

xlim

x and y axis limits e.g. xlim = c(0, 1000), ylim = c(0, 1).

title

the title of the plot.

xlab

main title and axis labels

ylab

main title and axis labels

legend

character specifying legend position. Allowed values are one of c("top", "bottom", "left", "right", "none"). Default is "top" side position. to remove the legend use legend = "none". Legend position can be also specified using a numeric vector c(x, y); see details section.

legend.title

legend title.

legend.labs

character vector specifying legend labels. Used to replace the names of the strata from the fit. Should be given in the same order as those strata.

y.text

logical. Default is TRUE. If FALSE, the table y axis. tick labels will be hidden.

y.text.col

logical. Default value is FALSE. If TRUE, the table tick labels will be colored by strata.

fontsize

text font size.

ggtheme

function, ggplot2 theme name. Default value is theme_survminer. Allowed values include ggplot2 official themes: see theme.

...

other arguments passed to the function ggpar.

Value

a ggplot.

Examples

Run this code
# Fit survival curves
require("survival")
fit<- survfit(Surv(time, status) ~ sex, data = lung)

# Basic plot
ggcumcensor(fit, data = lung)

# Change color by strata
# Remove y tick labels
ggcumcensor(fit, data = lung, color = "strata",
  y.text = FALSE)



Run the code above in your browser using DataLab