# NOT RUN {
#Start with a base swimmer plot
swim_plot <-
swimmer_plot(df=ClinicalTrial.Arm,id='id',end='End_trt',
name_fill='Arm',col="black",id_order='Arm',alpha=0.6)
# Then add text to the plot
swim_plot_with_text <- swim_plot + swimmer_text(df_text =
ClinicalTrial.Stage,label = 'Stage',size=3,
fontface=ifelse(ClinicalTrial.Stage$Stage=="Early Stage","bold","plain"))
# Add ggplot layers to improve the plot's aesthetic
swim_plot_with_text +
ggplot2::scale_fill_manual(name="Treatment",values=c("#e41a1c", "#377eb8","#4daf4a"))+
ggplot2::ylab('Time (Days)')
# }
Run the code above in your browser using DataLab