Skip to content

Commit

Permalink
New argument tables.col #154
Browse files Browse the repository at this point in the history
  • Loading branch information
kassambara committed Mar 11, 2017
1 parent b1f3352 commit 6b3f6c1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ p %+% theme_survminer(
## Major changes

- Additional `data` argument added to the `ggsurvplot()` function ([@kassambara, #142](https://github.com/kassambara/survminer/issues/142)). Now, it's recommended to pass to the function, the data used to fit survival curves. This will avoid the error generated when trying to use the `ggsurvplot()` function inside another functions ([@zzawadz, #125](https://github.com/kassambara/survminer/issues/125)).

- New argument `tables.col` in `ggsurvplot()` to change the color of all tables under the main plot, at once.

- New fonts and texts customization features for `ggsurvplot` ([@MarcinKosinski, #105](https://github.com/kassambara/survminer/issues/105)) ([@MarcinKosinski, #106](https://github.com/kassambara/survminer/issues/106))
- It is possible to specify subtitle (param `submain`) and caption (param `caption`) for the `curve` part of the `ggsurvplot`.
Expand Down
23 changes: 10 additions & 13 deletions R/ggsurvplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@
#'@param risk.table.pos character vector specifying the risk table position.
#' Allowed options are one of c("out", "in") indicating 'outside' or 'inside'
#' the main plot, respectively. Default value is "out".
#'@param risk.table.col color to be used for risk table. Default value is
#' "black". If you want to color by strata (i.e. groups), use risk.table.col =
#' "strata".
#'@param risk.table.col same as tables.col but for risk table only.
#'@param risk.table.fontsize,fontsize font size to be used for the risk table
#' and the cumulative events table.
#'@param risk.table.y.text logical. Default is TRUE. If FALSE, risk table y axis
Expand All @@ -72,6 +70,9 @@
#' of all tables under the main survival plot.
#'@param tables.y.text logical. Default is TRUE. If FALSE, the y axis tick
#' labels of tables will be hidden.
#'@param tables.col color to be used for all tables under the main plot. Default value is
#' "black". If you want to color by strata (i.e. groups), use tables.col =
#' "strata".
#'@param tables.theme function, ggplot2 theme name. Default value is
#' \link{theme_survminer}. Allowed values include ggplot2 official themes: see
#' \code{\link[ggplot2]{theme}}.
Expand All @@ -91,9 +92,7 @@
#'@param cumevents logical value specifying whether to show or not the table of
#' the cumulative number of events. Default is FALSE.
#'@param cumevents.title The title to be used for the cumulative events table.
#'@param cumevents.col color to be used for cumulative events table. Default
#' value is "black". If you want to color by strata (i.e. groups), use
#' cumevents.col = "strata".
#'@param cumevents.col same as tables.col but for the cumulative events table only.
#'@param cumevents.y.text logical. Default is TRUE. If FALSE, the y axis tick
#' labels of the cumulative events table will be hidden.
#'@param cumevents.y.text.col logical. Default value is FALSE. If TRUE, the y
Expand All @@ -103,9 +102,7 @@
#'@param cumcensor logical value specifying whether to show or not the table of
#' the cumulative number of censoring. Default is FALSE.
#'@param cumcensor.title The title to be used for the cumcensor table.
#'@param cumcensor.col color to be used for cumcensor table. Default value is
#' "black". If you want to color by strata (i.e. groups), use cumcensor.col =
#' "strata".
#'@param cumcensor.col same as tables.col but for cumcensor table only.
#'@param cumcensor.y.text logical. Default is TRUE. If FALSE, the y axis tick
#' labels of the cumcensor table will be hidden.
#'@param cumcensor.y.text.col logical. Default value is FALSE. If TRUE, the y
Expand Down Expand Up @@ -383,19 +380,19 @@ ggsurvplot <- function(fit, data = NULL, fun = NULL,
xlim = NULL, ylim = NULL,
legend = c("top", "bottom", "left", "right", "none"),
legend.title = "Strata", legend.labs = NULL,
tables.height = 0.25, tables.y.text = TRUE,
tables.height = 0.25, tables.y.text = TRUE, tables.col = "black",
risk.table = FALSE, risk.table.pos = c("out", "in"), risk.table.title = NULL,
risk.table.col = "black", risk.table.fontsize = 4.5, fontsize = 4.5,
risk.table.col = tables.col, risk.table.fontsize = 4.5, fontsize = 4.5,
risk.table.y.text = tables.y.text,
risk.table.y.text.col = TRUE,
risk.table.height = tables.height, surv.plot.height = 0.75,
ncensor.plot.height = tables.height, cumevents.height = tables.height,
cumcensor.height = tables.height,
ncensor.plot = FALSE,
ncensor.plot.title = NULL,
cumevents = FALSE, cumevents.col = "black", cumevents.title = NULL,
cumevents = FALSE, cumevents.col = tables.col, cumevents.title = NULL,
cumevents.y.text = tables.y.text, cumevents.y.text.col = TRUE,
cumcensor = FALSE, cumcensor.col = "black", cumcensor.title = NULL,
cumcensor = FALSE, cumcensor.col = tables.col, cumcensor.title = NULL,
cumcensor.y.text = tables.y.text, cumcensor.y.text.col = TRUE,
surv.median.line = c("none", "hv", "h", "v"),
ggtheme = theme_survminer(),
Expand Down
35 changes: 17 additions & 18 deletions man/ggsurvplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6b3f6c1

Please sign in to comment.