STHDA forum

survminer » [Solved] Confidence interval as vector file

Administrator

rank_admin.png

Avatar

Signed up since: 10/02/2013

Messages: 32

On 08/06/2017 at 09h29
(e-mail from a user)

Dear authors of the survminer package for R,
first of all thank you for developing this nice tool. I've recently used your package to plot Kaplan-Meier curves with 95% confidence interval for a study and the manuscript has been accepted in a medical journal. However, the journal recreates in-house all the figures and an .eps file was requested. When I export the picture as vector file I lost 95% confidence interval. I tried to bypass the issue by saving the figure in a raster format and converting to .eps but that was not acceptable for the journal because they cannot use each element in Adobe Illustrator.

Could you please indicate to me how to directly export the figure as vector file without losing confidence intervals?

Thank you very much.
Website    

Administrator

rank_admin.png

Avatar

Signed up since: 10/02/2013

Messages: 32

On 08/06/2017 at 09h30
Re:


Congratulation for your manuscript!! The confidence band is semi-transparent. The problem is that EPS in R does not support transparency.

There are 2-3 solutions to bypass this problem.

Please, try the cairo-based postscript graphics devices and let me know:


Code R :
 
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Fit and visualize survival curves
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Fit survival curves
require("survival")
fit<- survfit(Surv(time, status) ~ sex, data = lung)
# Visualize
library("survminer")
p <- ggsurvplot(fit, data = lung,
         surv.median.line = "hv", # Add medians survival
         pval = TRUE,             # Add p-value and tervals
 
         conf.int = TRUE,        # Add the 95% confidence band
         risk.table = TRUE,      # Add risk table
         tables.height = 0.2,
         tables.theme = theme_cleantable(),
         palette = "jco",
         ggtheme = theme_bw()
    )
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Export to .eps format
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
cairo_ps(filename = "survival-curves.ps",
         width = 7, height = 7, pointsize = 12,
         fallback_resolution = 300)
 
print(p)
 
dev.off()
 
Website    
Answer
You aren't allowed to write in this category
1 User online : 0 Administrator, 0 Moderator, 0 Member and 1 Visitor
User online : No member online