Stratifaction
Swimmer Plot


Plots can be stratified by any variable in the dataframe like Age and Sex :
We will here use the swimmer_plot function in the Data & Functions page and the stratify = option.

# Libraries
library(ggplot2)
library(swimplot)
# Stratifaction
swim_plot_stratify <-swimmer_plot(df=ClinicalTrial.Arm,id='id',start = 0, end='End_trt',name_fill='Arm',
                        col="black",alpha=0.75,width=.8,base_size = 14,stratify= c('Age','Sex')) +
                    theme(axis.text.y=element_blank(), # Not display id axis
                    axis.ticks.y=element_blank())

swim_plot_stratify




Contact

This document is a work of the statistics team in the Biostatistics and Medical Information Department at Saint-Louis Hospital in Paris (SBIM).
Based on The R Graph Gallery by Yan Holtz.