Add arrows to the ends of swimmer plot lanes to indicate unknown statuses or continued record-level trajectories.
Usage
add_arrows(
data = NULL,
mapping = NULL,
position = "identity",
arrow = NULL,
arrow_colour = "black",
arrow_head_length = unit(0.25, "inches"),
arrow_neck_length = NULL,
arrow_fill = NULL,
arrow_type = "closed"
)
Arguments
- data
a dataframe prepared for use with
ggswim()
- mapping
Set of aesthetic mappings created by
aes()
. If specified andinherit.aes = TRUE
(the default), it is combined with the default mapping at the top level of the plot. You must supplymapping
if there is no plot mapping.- position
Position adjustment. ggswim accepts either "stack", or "identity" depending on the use case. Default "identity".
Details
add_arrows()
wraps a new geom_segment()
layer by adding a zero-length
segment at the right end of swimmer lanes. This approach allows users to
specify arrow_neck_length
which can be useful for tracking and visualizaing
time in between markers
Examples
if (FALSE) {
add_arrows(
data = patient_status,
mapping = aes(xend = end_time, y = pt_id),
arrow = arrow,
arrow_neck_length = time_from_today,
arrow_colour = "forestgreen",
arrow_fill = "forestgreen"
)
}