Conditionally add dashed lines for treatment timepoints
maybe_add_dashed_lines.Rd
This internal function checks whether there are valid treatment timepoints and labels in the `plot_info` list. If found, it adds dashed vertical lines and their corresponding x-axis values to the plot. The treatment timepoints and labels can either be named lists (for multiple levels) or unnamed single elements.
Arguments
- p
A ggplot object. The plot to which dashed lines and labels will be added.
- plot_info
A list containing the treatment timepoints and treatment labels. Treatment timepoints and labels can either be unnamed elements or named lists where each element corresponds to a different `level`.
- level
A character string. Used to extract the treatment timepoints and labels when they are stored in named lists.
- y_pos
A numeric value specifying the y-axis position where the text labels should be placed. Defaults to 1.