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

Comments

Projects
None yet
2 participants
@MarcinKosinski
Contributor

MarcinKosinski commented Feb 22, 2016

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/kassambara/survminer/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

This comment has been minimized.

Show comment
Hide comment
@kassambara

kassambara Feb 23, 2016

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

Owner

kassambara commented Feb 23, 2016

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

This comment has been minimized.

Show comment
Hide comment
@MarcinKosinski

MarcinKosinski Feb 23, 2016

Contributor

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)
Contributor

MarcinKosinski commented Feb 23, 2016

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 pull request #12 from kassambara/master
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