Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions R/ggsurvplot_facet.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ NULL
#' the labels for the "sex" variable. For two grouping variables, you can use
#' for example panel.labs = list(sex = c("Male", "Female"), rx = c("Obs",
#' "Lev", "Lev2") ).
#'@param labeller A labeller function as described in
#'\code{\link[ggplot2:facet_wrap]{ggplot2:facet_wrap}}. This function overrides
#' short.panel.labs and panel.labs.
#'@param panel.labs.background a list to customize the background of panel
#' labels. Should contain the combination of the following elements: \itemize{
#' \item \code{color, linetype, size}: background line color, type and size
Expand Down Expand Up @@ -59,6 +62,7 @@ ggsurvplot_facet <- function(fit, data, facet.by,
nrow = NULL, ncol = NULL,
scales = "fixed",
short.panel.labs = FALSE, panel.labs = NULL,
labeller = NULL,
panel.labs.background = list(color = NULL, fill = NULL),
panel.labs.font = list(face = NULL, color = NULL, size = NULL, angle = NULL),
panel.labs.font.x = panel.labs.font,
Expand Down Expand Up @@ -164,7 +168,8 @@ ggsurvplot_facet <- function(fit, data, facet.by,
panel.labs.background = panel.labs.background,
panel.labs.font = panel.labs.font,
panel.labs.font.x =panel.labs.font.x,
panel.labs.font.y = panel.labs.font.y)
panel.labs.font.y = panel.labs.font.y,
labeller = labeller)

# Pvalues
#:::::::::::::::::::::::::::::::::::::::::
Expand Down Expand Up @@ -211,7 +216,8 @@ ggsurvplot_facet <- function(fit, data, facet.by,
panel.labs.background = list(color = NULL, fill = NULL),
panel.labs.font = list(face = NULL, color = NULL, size = NULL, angle = NULL),
panel.labs.font.x = panel.labs.font,
panel.labs.font.y = panel.labs.font
panel.labs.font.y = panel.labs.font,
labeller = NULL
)
{

Expand All @@ -221,6 +227,7 @@ ggsurvplot_facet <- function(fit, data, facet.by,

.labeller <- "label_value"
if(!short.panel.labs) .labeller <- label_both
if(!is.null(labeller)) .labeller <- labeller

if(length(facet.by) == 1){
facet.formula <- paste0("~", facet.by) %>% stats::as.formula()
Expand Down
5 changes: 5 additions & 0 deletions man/ggsurvplot_facet.Rd

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