Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix #110 #111

Merged
merged 2 commits into from Jan 21, 2017
Jump to file or symbol
Failed to load files and symbols.
+25 −12
Split
View
@@ -94,10 +94,11 @@ ggcoxfunctional <- function (formula, data, iter = 0, f = 0.6,
#' @param x an object of class ggcoxfunctional
#' @param ... further arguments passed to print, but really it's unused
+#' @param newpage open a new page. See \code{\link{grid.arrange}}.
#' @method print ggcoxfunctional
#' @rdname ggcoxfunctional
#' @export
-print.ggcoxfunctional <- function(x, ...){
+print.ggcoxfunctional <- function(x, ..., newpage = TRUE){
if(!inherits(x, "ggcoxfunctional"))
stop("An object of class ggcoxfunctional is required.")
plots <- x
@@ -111,6 +112,6 @@ print.ggcoxfunctional <- function(x, ...){
grobs[[i]]$widths[2:5] <- as.list(maxwidth)
}
y.text <- attr(plots, "y.text")
- do.call(gridExtra::grid.arrange, c(grobs, left = y.text))
+ do.call(gridExtra::grid.arrange, c(grobs, left = y.text, newpage = newpage))
}
View
@@ -153,10 +153,11 @@ ggcoxzph <- function (fit, resid = TRUE, se = TRUE, df = 4, nsmo = 40, var,
#' @param x an object of class ggcoxzph
#' @param ... further arguments passed to print, but really it's unused
+#' @param newpage open a new page. See \code{\link{grid.arrange}}.
#' @method print ggcoxzph
#' @rdname ggcoxzph
#' @export
-print.ggcoxzph <- function(x, ...){
+print.ggcoxzph <- function(x, ..., newpage = TRUE){
if(!inherits(x, "ggcoxzph"))
stop("An object of class ggcoxzph is required.")
plots <- x
@@ -173,6 +174,6 @@ print.ggcoxzph <- function(x, ...){
if(!is.null(pval)) main <- paste0("Global Schoenfeld Test p: ", signif(pval, 4), "\n")
else main <- NULL
- do.call(gridExtra::grid.arrange, c(grobs, top = main))
+ do.call(gridExtra::grid.arrange, c(grobs, top = main, newpage = newpage))
}
View
@@ -530,10 +530,11 @@ ggsurvplot <- function(fit, fun = NULL,
}
#' @param x an object of class ggsurvplot
+#' @param newpage open a new page. See \code{\link{grid.arrange}}.
#' @method print ggsurvplot
#' @rdname ggsurvplot
#' @export
-print.ggsurvplot <- function(x, surv.plot.height = NULL, risk.table.height = NULL, ncensor.plot.height = NULL, ...){
+print.ggsurvplot <- function(x, surv.plot.height = NULL, risk.table.height = NULL, ncensor.plot.height = NULL, ..., newpage = TRUE){
if(!inherits(x, "ggsurvplot"))
stop("An object of class ggsurvplot is required.")
@@ -581,7 +582,7 @@ print.ggsurvplot <- function(x, surv.plot.height = NULL, risk.table.height = NUL
for (i in 1:length(grobs)) {
grobs[[i]]$widths[2:5] <- as.list(maxwidth)
}
- do.call(gridExtra::grid.arrange, c(grobs, nrow = nplot, heights = heights ))
+ do.call(gridExtra::grid.arrange, c(grobs, nrow = nplot, heights = heights, newpage = newpage))
}
}
View
@@ -241,10 +241,11 @@ plot.surv_cutpoint <- function(x, variables = NULL, ggtheme = theme_classic2(),
p
}
+#' @param newpage open a new page. See \code{\link{grid.arrange}}.
#' @method print plot_surv_cutpoint
#' @rdname surv_cutpoint
#' @export
-print.plot_surv_cutpoint <- function(x, ...){
+print.plot_surv_cutpoint <- function(x, ..., newpage = TRUE){
if(!inherits(x, "plot_surv_cutpoint"))
stop("x must be an object of class plot_surv_cutpoint.")
x$distribution <- x$distribution + theme(legend.position = "none")+labs(x = NULL)
@@ -264,7 +265,7 @@ print.plot_surv_cutpoint <- function(x, ...){
cutpoint <- attr(x, "cutpoint")
main <- name <- attr(x, "name")
# main <- paste0(name,"- cutpoint: ", attr(x, "cutpoint"))
- do.call(gridExtra::grid.arrange, c(grobs, top = main))
+ do.call(gridExtra::grid.arrange, c(grobs, top = main, newpage = newpage))
}
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.