Description Usage Arguments Value See Also Examples
This function allows you to add lines to a swimmers plot created with swimmer_plot
1 2 3 4 5 6 7 8 9 10 11 12 |
df_lines |
a data frame |
id |
column name for id, default is 'id' |
start |
column name with the line start locations |
end |
column name with the line end locations |
adj.y |
amount to adjust the line within the box vertically (default is 0, line is in the centre of each bar) |
name_linetype |
a column name to map the line type |
name_col |
a column name to map the line colour |
name_size |
a column name to map the line size |
name_alpha |
a column name to map the line transparency |
... |
additional geom_segment() arguments |
a swimmer plot with lines
swimmer_plot
swimmer_points
swimmer_lines
swimmer_points_from_lines
swimmer_arrows
swimmer_text
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #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')
# Then add lines to the plot
swim_plot_with_lines <- swim_plot +
swimmer_lines(df_lines=ClinicalTrial.Response,id='id',start =
'Response_start',end='Response_end',name_col='Response',size=3)
# Add ggplot layers to improve the plot's aesthetic
swim_plot_with_lines +
ggplot2::scale_color_manual(name="Response",values=c("grey20","grey80"))+
ggplot2::scale_fill_manual(name="Treatment",values=c("#e41a1c", "#377eb8","#4daf4a"))+
ggplot2::ylab('Time (Days)')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.