Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post-custiomization does not affect risk.table.y.text.col #12

Closed
MarcinKosinski opened this issue Feb 22, 2016 · 2 comments
Closed

post-custiomization does not affect risk.table.y.text.col #12

MarcinKosinski opened this issue Feb 22, 2016 · 2 comments

Comments

@MarcinKosinski
Copy link
Contributor

Check this plot in which survival curves and confidence intervals are customized but one can't change the color of risk.table.y.text.col [https://github.com//issues/8]

# prepare survival data
library(RTCGA.clinical)
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)
# 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()
survplot$plot <- survplot$plot + scale_fill_pander() +  scale_colour_pander()

risk_table_col_issue

https://github.com/kassambara/survminer/blob/master/R/ggsurvplot.R#L338-L343 I know that the issues is somewhere over here but I am not so familiar with your package (YET!) to provide a useful pull request.

@kassambara
Copy link
Owner

Now, post-customization of survival curve colors will automatically affect the risk table y axis text colors

# Fit survival curves
library("survival")
fit<- survfit(Surv(time, status) ~ sex, data = lung)

# Default plot
p <- ggsurvplot(fit, risk.table = TRUE, 
  pval = TRUE, risk.table.y.text.col = TRUE)
print(p)

# Customize
p$plot <- p$plot + ggthemes::scale_color_pander()
print(p)

Thanks,
A. Kassambara

@MarcinKosinski
Copy link
Contributor Author

Thanks. Could you provide link to commit when you finally fix the issue, so that one might learn in meantime what changes have you made, in case one day I'll manage to provide my own PR without troubling you to fix my ideas :)

PS. below example with table

library(survminer)
# Fit survival curves
library("survival")
fit<- survfit(Surv(time, status) ~ sex, data = lung)

# Default plot
p <- ggsurvplot(fit, risk.table = TRUE, 
                pval = TRUE, risk.table.y.text.col = TRUE)
print(p)

# Customize
p$plot <- p$plot + ggthemes::scale_color_pander()
p$table <- p$table + ggthemes::scale_color_pander()
print(p)

kassambara pushed a commit that referenced this issue Jan 27, 2017
Merge master with MarcinKosinski::fork
kassambara pushed a commit that referenced this issue Mar 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants