Skip to content

Post-customization warnings #11

@MarcinKosinski

Description

@MarcinKosinski

Relating to #2 I am trying to post-customize the result theme of the survplot but it looks like colour and fill and pre-determined so post-customization triggers warnings like this

> # prepare survival data
> library(RTCGA.clinical)
Loading required package: RTCGA
Welcome to the RTCGA (version: 1.1.14).
> survivalTCGA(BRCA.clinical, OV.clinical, extract.cols = "admin.disease_code") -> BRCAOV.survInfo
> times = "times"
> status = "patient.vital_status"
> explanatory.names = "admin.disease_code"
> x = BRCAOV.survInfo
> 
> # fit survival estimates
> library(survival)
> formu <- eval(as.formula(paste0("survival::Surv(", times, ",", status, ") ~ ",
+                                                               paste0(explanatory.names, collapse = " + "))))
> fit <- do.call(survival::survfit, list(formula = formu, data = x))
> library(survminer)
Loading required package: ggplot2
> # create survival plot
> ggsurvplot(fit,
+                    risk.table = TRUE, 
+                    risk.table.y.text.col = TRUE,
+                    legend = "none",
+                    conf.int = TRUE, 
+                    pval = TRUE) -> survplot
> # customize theme
> library(ggthemes)
> survplot$table <- survplot$table + scale_fill_pander() +  scale_colour_pander()
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
> survplot$plot <- survplot$plot + scale_fill_pander() +    scale_colour_pander()
Scale for 'fill' is already present. Adding another scale for 'fill', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.

I know that this warning messages are not serious but I would like to know how to omit those warnings in case someone not skilled might think it's a serious problem. Do you know whether I can specify parameters of ggsurvplot so that I would not have such warnings? Or do I can somehow specify those scale functions in the theme argument of ggsurvplot?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions