kassambara / survminer

Survival Analysis and Visualization
https://rpkgs.datanovia.com/survminer/
506 stars 162 forks source link

Is the Graph of "Number of censoring" changing into new style? #456

Closed mc123at closed 4 years ago

mc123at commented 4 years ago

### THE SAME CODE BEFORE

2

### THE SAME CODE NOW

1

Steps to reproduce the problem

Code: ##start library(survminer) library(survival) rt=read.table("DFS.txt",header=T,sep="\t",check.names=F)
rt$futime=rt$futime/365
outTab=data.frame()

for(gene in colnames(rt[,4:ncol(rt)])){ a=rt[,gene]<=median(rt[,gene]) diff=survdiff(Surv(futime, fustat) ~a,data = rt) pValue=1-pchisq(diff$chisq,df=1) outTab=rbind(outTab,cbind(gene=gene,pvalue=pValue))

fit <- survfit(Surv(futime, fustat) ~ a, data = rt) summary(fit)

if(pValue<0.05){ if(pValue<0.001){ pValue="<0.001" }else{ pValue=round(pValue,3) pValue=paste("=",pValue) } pdf(file=paste(gene,".DFS.GSE31210.survival.pdf",sep=""), height = 8, width = 5) survp <- ggsurvplot(fit,palette = c('#FF0000', '#0000FF'), title = paste("DFS of ", gene, " in GSE31210", sep=""), #subtitle = "Based on Kaplan-Meier estimator",

font.title = c(13, "bold", "darkblue"),

                     #font.subtitle = c(11, "bold.italic", "purple"),
                     #font.caption = c(14, "plain", "orange"),

                     #font.tickslab = c(12, "plain", "darkgreen"),
                     risk.table.col = "strata", # Change risk table color by groups, 
                     linetype = "strata", # Change line type by groups
                     surv.median.line = "hv", # Specify median survival
                     risk.table =TRUE,
                     pval =TRUE,
                     conf.int =TRUE,
                     xlab ='Time in years', 
                     legend.title = "Group",
                     legend.labs = c("High", "Low"),

                     ggtheme = theme_light(), #ggtheme = theme_bw() ggtheme = theme_minimal() ggtheme = theme_light()
                     ncensor.plot = TRUE)

print(survp, newpage = FALSE)
dev.off()

} } write.table(outTab,file="DFS.GSE31210.xls",sep="\t",row.names=F,quote=F) ##END

These two pictures were created by the same code. But the first picture created earlier than the second one. The problem is NOW when I use the same code to create, only the second style can deliver. Is there a "code" that can change the style? And how to read the "Number of censoring" in the second style? Is the second style ready for publishing?

mc123at commented 4 years ago

solved.

I downgraded ggplot2 to 3.2.1.