From 6e3b3864fd39bf3449b08dcde43aba2c30c6a62c Mon Sep 17 00:00:00 2001 From: Michal Jakubczak Date: Thu, 18 Mar 2021 13:49:44 +0100 Subject: [PATCH] grid.draw method for ggsurvplot --- NAMESPACE | 1 + R/ggsurvplot.R | 8 ++++++++ man/ggsurvplot.Rd | 3 +++ 3 files changed, 12 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 66e0e14..11855e9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,7 @@ # Generated by roxygen2: do not edit by hand S3method("+",ggsurv) +S3method(grid.draw,ggsurvplot) S3method(plot,surv_cutpoint) S3method(print,ggcoxfunctional) S3method(print,ggcoxzph) diff --git a/R/ggsurvplot.R b/R/ggsurvplot.R index ba2b7d2..870594b 100644 --- a/R/ggsurvplot.R +++ b/R/ggsurvplot.R @@ -429,3 +429,11 @@ print.ggsurvplot <- function(x, surv.plot.height = NULL, risk.table.height = NUL grid::grid.draw(res) } + +#' @param x an object of class ggsurvplot +#' @method grid.draw ggsurvplot +#' @rdname ggsurvplot +#' @export +grid.draw.ggsurvplot <- function(x){ + print(x, newpage = FALSE) +} diff --git a/man/ggsurvplot.Rd b/man/ggsurvplot.Rd index 5310c77..72fbdc2 100644 --- a/man/ggsurvplot.Rd +++ b/man/ggsurvplot.Rd @@ -3,6 +3,7 @@ \name{ggsurvplot} \alias{ggsurvplot} \alias{print.ggsurvplot} +\alias{grid.draw.ggsurvplot} \title{Drawing Survival Curves Using ggplot2} \usage{ ggsurvplot( @@ -38,6 +39,8 @@ ggsurvplot( newpage = TRUE, ... ) + +\method{grid.draw}{ggsurvplot}(x) } \arguments{ \item{fit}{allowed values include: