← Back to all sparks
G

ggsurvfit

ANALYTICS
Velocity2.5

ggsurvfit — R package from the pharmaverse project

ggsurvfit is in correctness-and-compatibility mode, not feature mode.

survival-analysisggplot2competing-risksclinical-plotscdisc
Current state
The package draws survival and cumulative-incidence curves on a ggplot2 grammar, with risk tables, p-values and quantile annotations. Recent releases are entirely fixes and upstream tracking: ggplot2 v4.0.0 compatibility in 2025, and a 2026 patch correcting a Gray-test p-value that could be reported for the wrong competing event.
Where it's heading
The feature surface settled around 1.0.0, when risk-table alignment was exported and colour and linetype defaults became configurable. Since then the work is keeping pace with survival, ggplot2 and tidycmprsk changes, and closing cases where the plotted curve and the annotation disagreed — the p-value matched by position rather than name, confidence limits swapped for multi-state models, quantiles read off a plateau.
Prediction
Expect the next release to track upstream survival or ggplot2 changes rather than add plotting features; the CDISC censoring convention adopted in Surv_CNSR() suggests further alignment with clinical data standards is the likelier direction.

Recent moves

  1. 20d ago

    Gray-test p-values matched to the plotted outcome by name

    Three correctness fixes where the annotation disagreed with the curve: the Gray-test p-value is now matched to the plotted outcome by name rather than position, add_quantile() uses the midpoint of a flat plateau, and Surv_CNSR() accepts values of 1 or more as censoring per CDISC guidance.

    View source ↗
  2. 10mo ago

    ggplot2 v4.0.0 compatibility and multi-state CI label fix

    Tracks ggplot2 v4.0.0 and fixes confidence-interval labels that were swapped for multi-state models in tidy_survfit(). Continues the pattern of upstream compatibility work rather than new plotting capability.

    View source ↗
  3. 2y ago

    Negative follow-up times and a cloglog transformation

    Handles negative follow-up times, honours survfit(start.time), adapts to the matrix form survival now returns for censored counts in multi-state models, and adds a cloglog transformation option. Compatibility work with a small feature attached.

    View source ↗
  4. 2y ago

    Aesthetic defaults become switchable and alignment is exported

    The release where the plotting defaults became configurable: a global option to switch colour and linetype aesthetics, and ggsurvfit_align_plots() exported so users can build custom risk tables. It marks the point the feature surface settled.

    View source ↗
  5. 2y ago

    Confidence limits corrected for monotonicity-reversing transforms

    A single fix swapping conf.low and conf.high column names for transformations that reverse the curve's monotonicity.

    View source ↗
  6. 3y ago

    Glue syntax in risk tables and coxph model support

    Adds glue-style syntax to add_risktable(risktable_stats=) so several formatted statistics can share a row, and extends ggsurvfit(), tidy_survfit() and survfit2() to handle coxph models. The risk table stops being a fixed template and becomes user-composed.

    View source ↗